aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src/state.rs
Commit message (Collapse)AuthorAgeFilesLines
...
| * | tor-dirmgr: Remove redundant hashtable.Nick Mathewson2022-03-161-22/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | We were using a hashtable to keep track of missing microdescriptor digests. But this information is redundant with the NetDir state, and there's now no longer any performance benefit to keeping a separate copy. Part of #386.
* | | DirMgrConfig: abolish builder; make it transparent and exhaustiveIan Jackson2022-03-161-5/+5
|/ / | | | | | | See rationale in the comment.
* | dirmgr: Call shrink_to_fit on missing-microdesc hashtableNick Mathewson2022-03-101-0/+7
| | | | | | | | | | | | | | | | | | | | This hashtable starts out pretty large, but it can spend most of our runtime (when we aren't downloading) being small. To avoid doing too much work, I've made it so we only call shrink_to_fit twice per consensus: once when we're no longer pending, and once when we're complete. Closes #388.
* | Use RsaIdentity::from_hex() and hex::decode_to_slice in more placesNick Mathewson2022-03-041-2/+1
|/ | | | These aren't critical-path, but they do make the code a little nicer.
* dirmgr::Store.expire_all takes configtharvik2022-02-231-2/+2
|
* dirmgr: add Store traittharvik2022-02-231-16/+24
|
* dirmgr: Remember where netdocs came from.Nick Mathewson2022-02-161-12/+20
| | | | | This isn't complete (see TODO), but it's enough to let us report the right ErrorKind if something fails to parse.
* dirmgr: eliminate StringParsingError.Nick Mathewson2022-02-161-3/+4
| | | | | | | | It had too many possible Kinds depending on what kind of string had failed to parse. I decided to use #[source] here instead of #[from], so that we would have to explicitly convert these errors where they show up.
* dirmgr: HasKind for internal and sqlite errorsNick Mathewson2022-02-161-2/+3
| | | | | At first I had thought that all sqlite errors would be internal, but that's not the case.
* Fix test failure in tor_dirmgr::state::test::get_microdescs_stateNick Mathewson2022-01-271-1/+12
| | | | | | | | | This failure occurred because our tests use canned data to exercise the directory state functionality, and the canned consensus has suddenly become very expired. There are better fixes possible, but this is a minimal one that should get CI working on main again.
* bootstrap reporting: Documentation fixups from review.Nick Mathewson2022-01-191-1/+2
|
* tor-dirmgr: Create a bootstrap-status exporting mechanism.Nick Mathewson2022-01-181-3/+69
| | | | | | | | | | | | | | | | | | | | | | The interface is similar to the one exposed by `arti-client`: it internally uses postage::watch to give a series of events showing when a bootstrap status is changing. Thanks to the existing state/driver separation in the DirMgr design we don't need much new logic: each download state needs to expose (internally) how far along it is in its download, which the bootstrap code passes to the DirMgr if it has changed. I believe that in the long run, we'll probably want to expose more (or different) information here, and we'll want to process it differently. With that in mind, I've made the API for `DirBootstrapStatus` deliberately narrow, so that we can change its of its internal later on without breaking code that depends on it. (The information exposed by this commit is not yet summarized in `arti-client`.) Part of #96.
* Fixup broken doc comment from arti!220eta2022-01-101-1/+1
| | | | That's what I get for blindly trusting @nickm :p
* Merge branch 'ticket_178' into 'main'eta2022-01-101-9/+73
|\ | | | | | | | | | | | | Fix ticket 178: Don't use a NetDir until we have microdescriptors for all of our primary guards. Closes #178 See merge request tpo/core/arti!220
| * Only replace netdir once we have enough guard MDs.Nick Mathewson2022-01-061-9/+73
| | | | | | | | | | | | | | | | This prevents a security-failure condition that could happen if our directory caches don't give us these microdescriptors, but we nevertheless decide that the directory is usable. Closes #178
* | Fix busy-loop when consensus is near expiring.Nick Mathewson2022-01-071-1/+14
|/ | | | | | | | | | | | | | When our current consensus is getting close to being invalid (but it isn't invalid yet), we try to get a new one. So far, so good. But we had a bug: when we went to get a new consensus, we'd see that we had a perfectly fine not-yet-invalid consensus in our cache, reload it, find that it was ready, and continue! This patch fixes our behavior: If we have a usable consensus, then when we reset the bootstrapping process, we ignore any cached consensus. Fixes bug #274.
* tor-dirmgr: retain cache_usage on reset.Nick Mathewson2021-12-161-4/+19
| | | | | | | Previously we didn't retain the value of our cache_usage field when calling reset() from GetMicrodescsState. This resolves an XXXX comment.
* Merge branch 'flag-publish-2' into 'main'eta2021-12-161-5/+3
|\ | | | | | | | | Refactor directory events to use a new FlagPublisher mechanism. See merge request tpo/core/arti!188
| * Refactor directory events to use a FlagPublisher mechanism.Nick Mathewson2021-12-141-5/+3
| | | | | | | | | | | | | | | | This approach tries to preserve the current interface, but uses a counter-based event backend to implement a coalescing stream of events that can be represented as small integers. The advantage here is that publishing events no longer needs to be a blocking operation, since there is no queue to fill up.
* | tor-dirmgr: Warn on a bug case.Nick Mathewson2021-12-161-2/+1
|/ | | | | | | | This warning occurs if we ask for microdescriptors from our local cache, and our cache gives us something we didn't ask for. It shouldn't be possible, so let's warn when it occurs. This patch resolves an XXXX.
* Make override_net_params take effect sooner.Nick Mathewson2021-12-071-1/+4
| | | | | This is still not as soon as I'd like: a real change here will require refactoring DirMgr::notify().
* Make much of DirMgrConfig reconfigurable.Nick Mathewson2021-12-071-8/+10
| | | | | | | | | | We can't change the authorities while in-flight: that would be pretty miserable to implement. Similarly we can't change the cache while in-flight. Everything else should be fair game, though there are a couple of tricky bits. I've tried to document those.
* deglob some enums, use concise iteration syntaxDaniel Eades2021-11-251-1/+1
|
* More typo fixes that I forgot to save :(Nick Mathewson2021-11-241-1/+1
|
* Rename RetryConfig to DownloadSchedule, fold in parallelism.Nick Mathewson2021-11-181-19/+10
|
* Fix typosDimitris Apostolou2021-11-121-1/+1
|
* More tests on tor-dirmgr::stateNick Mathewson2021-11-081-25/+111
| | | | | These test our download schedules, resetting to the original state, and storing downloaded objects.
* Remove one more test println!().Nick Mathewson2021-11-041-1/+0
|
* Remove some dbg!() calls in real code.Nick Mathewson2021-11-021-1/+0
|
* tor-dirmgr: tests for GetMicrodescsStateNick Mathewson2021-10-281-0/+100
|
* tor-dirmgr: tests for download schedules.Nick Mathewson2021-10-281-0/+23
|
* tor-dirmgr: Test for GetCertsStateNick Mathewson2021-10-281-5/+115
|
* tor-dirmgr: Tests for GetConsensusState.Nick Mathewson2021-10-281-0/+148
| | | | | | This test uses a consensus that I've copied from tor-netdoc/testdata. I would include it directly, but I think that will cause trouble when it comes time to run "cargo package".
* tor-dirmgr::state: Mock the view of current time.Nick Mathewson2021-10-281-3/+25
| | | | | This will let us test the state processing code without having to give it up-to-date directory objects.
* Migrate tor-dirmgr from chrono to time 0.3Nick Mathewson2021-10-241-4/+4
| | | | | (This appears to be the emerging consensus of how to handle RUSTSEC-2020-0159.)
* Merge branch 'share_state'Nick Mathewson2021-10-211-17/+32
|\
| * Mark consensus as "not-pending" even if its microdescs come from cache.Nick Mathewson2021-10-201-4/+24
| | | | | | | | | | | | | | Previously our code would clear the 'pending' flag on a consensus only when a _downloaded_ md made it become usable. Closes #199.
| * Move tor-dirmgr to use a sync::Mutex.Nick Mathewson2021-10-201-13/+8
| | | | | | | | | | The futures::lock::Mutex was unnecessary, since we never held it when we were suspending.
* | Fix most warnings from nightly.Nick Mathewson2021-10-191-0/+1
|/ | | | (One represents code that I forgot to write.)
* Remove useless into() conversions caught by clippy.Jani Monoses2021-10-181-9/+9
|
* Notify guard manager on network change and state flush.Nick Mathewson2021-10-101-0/+11
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+687
This will cause some pain for now, but now is really the best time to do this kind of thing.