summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src/state.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.