summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'clippy' into 'main'Ian Jackson2022-06-241-0/+3
|\ | | | | | | | | Fix clippy nightly again See merge request tpo/core/arti!603
| * Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | | | | | Update all lint blocks
* | Merge branch 'dirmgr' into 'main'Nick Mathewson2022-06-241-53/+49
|\ \ | | | | | | | | | | | | | | | | | | dirmgr: followups to !587, mostly using iterators Closes #468 See merge request tpo/core/arti!599
| * | dirmgr: Use ... .find().is_none() rather than clippy's suggestionIan Jackson2022-06-231-2/+4
| | |
| * | dirmgr: DirBootstrapStatus: Refactor mut_status_for using entries_mutIan Jackson2022-06-221-27/+25
| | | | | | | | | | | | IMO this is rather less confusing.
| * | dirmgr: Use new statuses() helper methodIan Jackson2022-06-221-21/+6
| | | | | | | | | | | | The two call sites become clearer, IMO.
| * | dirmgr: DirBootstrapStatus: Provide statuses and entries_mutIan Jackson2022-06-221-3/+18
| | | | | | | | | | | | | | | | | | | | | We're going to use these in a moment. One returns entries and the other statuses simply because that's what's actually going to be wanted.
| * | dirmgr: Remove a TODO commentIan Jackson2022-06-221-4/+0
| |/ | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/587#note_2815945
* / Fix a couple of typos in rustdoc comments.Nick Mathewson2022-06-241-1/+1
|/
* Merge branch 'display_source_cleanup' into 'main'eta2022-06-211-6/+6
|\ | | | | | | | | Do not include error source() in display() format. See merge request tpo/core/arti!598
| * Do not include error source() in display() format.Nick Mathewson2022-06-211-6/+6
| | | | | | | | | | | | | | | | | | According to doc/Errors.md, and in keeping with current best practices, we should not include display an error's `source()` as part of that error's display method. Instead, we should let the caller decide to call source() and display that error in turn. Part of #323.
* | Merge branch 'stalled_directory' into 'main'Ian Jackson2022-06-214-207/+573
|\ \ | |/ |/| | | | | | | | | Detect and report stalled directory downloads Closes #468 See merge request tpo/core/arti!587
| * Refactor DirStatus data structures.Nick Mathewson2022-06-211-74/+186
| | | | | | | | | | | | | | AttemptId is now linked to DirStatus in StatusEntry. DirBootstrapStatus now has an inner enum to make invalid status unrepresentable.
| * Make display formats work with older derive_more.Nick Mathewson2022-06-142-2/+2
| |
| * tor-dirmgr: Make DirStatus non-public.Nick Mathewson2022-06-142-4/+2
| | | | | | | | | | I believe this type was made public in error: No other crate uses it, and no API exposes it.
| * Add a blockage-reporting mechanism to tor-dirmgr.Nick Mathewson2022-06-142-1/+97
| | | | | | | | | | | | | | | | | | The `DirBootstrapStatus` type now exposes a blockage() method to return an `Option<DirBlockage>`. The blockage types reported are more low-level than I'd like, but they are IMO good enough for now: we'll want to get experience with actual vs hypothetical problems before we refine them.
| * Add a couple of TODO items.Nick Mathewson2022-06-141-0/+7
| |
| * Do not update_progress on load if nothing happened.Nick Mathewson2022-06-141-6/+10
| | | | | | | | | | If there was no partial information, then calling update_progress will now report a stall in this case, which is not what we want.
| * DirMgr: Track errors, stalls, and resets as part of status.Nick Mathewson2022-06-133-3/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A "reset" happens whenever we have to start a download attempt over -- either because we ran out of retries, or we found something wrong with the consensus after fetching certificates. An "error" happens when we have a recoverable error from one or more directory sources. A "stall" happens whenever a round of downloads or cache loads leads to no change in the status. We don't yet use this as part of our status reporting.
| * Refactor our logic for distinguishing download attemptsNick Mathewson2022-06-133-85/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we used the "if-modified-since" time associated with the consensus download, and/or the "valid-after" time in the consensus attempt, to put multiple attempts into sequence, and to tell one from another. But that approach was always a kludge, and will soon get more unreliable as the DirStatus logic gets a bit more complex. With this commit, we change separate download attempts to be identified with an AttemptId that increments whenever we decide to get a different directory from the one we have. IMO this new code is _much_ cleaner.
| * Refactor most DirStatus users to use DirProgress.Nick Mathewson2022-06-134-71/+66
| | | | | | | | This is all crate-internal APIs, fortunately.
| * Move `at_least_as_new_as` to DirProgress.Nick Mathewson2022-06-131-4/+18
| |
| * Turn the DirProgress in DirStatus into a named field.Nick Mathewson2022-06-131-52/+73
| |
| * Rename DirStatusInner to DirProgress.Nick Mathewson2022-06-132-38/+38
| | | | | | | | | | | | This is about to become only a _part_ of what defines a DirStatus: a DirStatus will also include a reset count, and some kind of info about how long we've gone without progress.
* | Merge branch 'config-fix2' into 'main'Nick Mathewson2022-06-163-70/+10
|\ \ | | | | | | | | | | | | Use impl_standard_builder more and remove manual Default/builder impls See merge request tpo/core/arti!594
| * | impl_standard_builder: Use for tor_dirmgr::AuthorityIan Jackson2022-06-161-10/+2
| | |
| * | impl_standard_builder: Use for tor_dirmgr::DownloadScheduleIan Jackson2022-06-161-14/+3
| | |
| * | impl_standard_builder: Use for tor_dirmgr::DownloadScheduleConfigIan Jackson2022-06-161-14/+1
| | |
| * | impl_standard_builder: Use for tor_dirmgr::NetworkConfigIan Jackson2022-06-161-19/+2
| | |
| * | impl_standard_builder: Use for tor_dirmgr::DirSkewToleranceIan Jackson2022-06-161-13/+2
| | |
* | | Merge branch 'config-fix' into 'main'Ian Jackson2022-06-162-3/+3
|\| | | | | | | | | | | | | | | | | | | | Config handling and logging fixes Closes #480 See merge request tpo/core/arti!589
| * | Add some missing `serde(default)` to uses of humantime_serde::optionIan Jackson2022-06-162-3/+3
| |/ | | | | | | | | Without this, if the substructure is provided, these fields are mandatory within it.
* | Fix clippy::significant_drop_in_scrutinee warningsNick Mathewson2022-06-152-9/+12
| | | | | | | | | | | | | | | | | | This is apparently a new warning from clippy nightly, documented in https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_in_scrutinee . I'm not in love with the temporary variables that this warning wants me to introduce, but it does seem like a decent way to avoid some kinds of deadlock.
* | Work around an erroneous warning from nightly clippyNick Mathewson2022-06-151-0/+3
|/
* Merge branch 'dormant_directory' into 'main'Nick Mathewson2022-06-132-88/+95
|\ | | | | | | | | | | | | Use TaskSchedule to sleep in directory bootstrapping Closes #497 See merge request tpo/core/arti!571
| * DirMgr: Use scopeguard crate in place of ad hoc RAII substitutesNick Mathewson2022-06-131-68/+18
| |
| * Put the task schedule back when the dl task exits.Nick Mathewson2022-06-131-2/+9
| | | | | | | | | | This will allow somebody else to call bootstrap() if bootstrap() fails the first time.
| * New API to expose and use TaskHandle from DirMgr.Nick Mathewson2022-06-131-2/+31
| | | | | | | | | | | | This change also means that we need to create the handle and scheduler earlier in the process of creating the DirMgr. If we don't, we won't have a way to manage the task before bootstrap() returns.
| * DirMgr: Refactor bootstrap to use a TaskSchedule for sleeping.Nick Mathewson2022-06-102-32/+53
| | | | | | | | | | | | This change (not yet exposed as an API) will let the TorClient have a `TaskHandle` corresponding to the directory task, letting it make the directory task dormant as needed.
* | Merge branch 'use-testing-rng'Nick Mathewson2022-06-073-3/+6
|\ \ | |/ |/|
| * Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-023-3/+6
| | | | | | | | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* | Merge branch 'lint' into 'main'Ian Jackson2022-05-311-0/+3
|\ \ | |/ |/| | | | | | | | | lints: Make lint blocks consistent and ensure they stay that way Closes #469 See merge request tpo/core/arti!557
| * lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-0/+1
| | | | | | | | | | From running add_warning, with manual picking of the right hunks/lines.
| * lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
| | | | | | | | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* | tor-dirmgr: Fix DirSkewToleranceIan Jackson2022-05-301-2/+2
|/ | | | | | This was upposed to be one day, I presume! Also complete a truncated sentence in the docs.
* DirMgr:: Remove Error::NoChange as redundant.Nick Mathewson2022-05-253-72/+25
| | | | | | | | Now that the relevant functions now report changed/not-changed status via a boolean out-parameter (see !527), there's no reason to have a separate NoChanged error case. Closes #484.
* Merge branch 'bug482' into 'main'eta2022-05-242-29/+133
|\ | | | | | | | | | | | | DirMgr: Stop load-from-cache process when there is no change. Closes #482 See merge request tpo/core/arti!527
| * DirMgr: Stop load-from-cache process when there is no change.Nick Mathewson2022-05-242-29/+133
| | | | | | | | | | | | | | | | | | | | | | | | Previously in !511 I had introduced a bug where, if there was an error more serious than "no change", that error would keep us from noticing that we had no change, and we'd loop until the safety counter ran out. Then we'd panic. This commit fixes the bug by reintroducing the `changed` boolean -- this time as an outparam for the add_from_* methods. Fixes #482.
* | fs-mistrust: make Mistrust have a corresponding Builder type.Nick Mathewson2022-05-242-8/+8
|/ | | | | This is an approximately minimal revision to get Builder in place; subsequent commits will clean up the API.
* Simplify advance and reset functions with mem::replace.Nick Mathewson2022-05-191-8/+4
|