aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src/event.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix deprecation-warning in tor-dirmgr.Nick Mathewson2026-06-301-2/+2
| | | | | time::format_description::parse is now deprecated; the replacement we want to use is first available in time 0.3.49.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* dirmgr: port to web-time-compat.Nick Mathewson2026-03-261-1/+2
|
* Fix word duplicate typosTobias Stoeckmann2026-03-151-1/+1
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-3/+4
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-dirmgr: Removed dependency on `once_cell`hashcatHitman2025-06-141-4/+7
| | | | | | - Replaced `once_cell::sync::Lazy` with `std::sync::LazyLock`. Signed-off-by: hashcatHitman <[email protected]>
* fix `clippy::doc_overindented_list_items`Steven Engler2025-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | Example: ```text warning: doc list item overindented --> crates/arti-rpc-client-core/src/conn/connimpl.rs:322:9 | 322 | /// indicates that no more messages will be received for this request. | ^^^ help: try using ` ` (2 spaces) | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_overindented_list_items note: the lint level is defined here --> crates/arti-rpc-client-core/src/lib.rs:8:9 | 8 | #![warn(clippy::all)] | ^^^^^^^^^^^ = note: `#[warn(clippy::doc_overindented_list_items)]` implied by `#[warn(clippy::all)]` ```
* Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-4/+4
| | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Upgrade to latest event-listenerNick Mathewson2024-02-261-1/+1
|
* educe: Use std's default for enums where default variant is unitIan Jackson2024-02-121-3/+2
| | | | | | | | | | | | | Since Rust 1.66, std's default works properly for enums, provided that the default variant is a unit. Review all uses of `#[educe(default)]` on enums and replace them with std where possible, which is most of them. In 1.66 and later, std's `#[derive(Default)]` doesn't infer any generic bounds on the derived impl, where it's an enum - since the unit variant can always be constructed. So this change doesn't add any generic bounds and is not API-visible.
* clippy nightly: For now, locally allow implied_bounds_in_implsIan Jackson2024-01-021-0/+2
| | | | | | Filed https://gitlab.torproject.org/tpo/core/arti/-/issues/1177 proposing a final fix.
* Upgrade event_listener dependency to 3.0.0Nick Mathewson2023-09-281-1/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Do some semi-manuallyIan Jackson2022-12-121-1/+9
| | | | | | | This is the hunks from running the rune in maint/adhoc-add-lint-blocks but which require some subsequent manual fixup: usually, deleting now-superfluous outer allows, but in some cases manually putting back lints that the adhoc script deleted.
* tor-dirmgr: impl Default for FlagPublisherIan Jackson2022-10-271-0/+6
|
* tor-dirmgr: impl FlagEvent for BridgeDescEventIan Jackson2022-10-271-0/+6
|
* FlagEvent trait: Implement using macrosIan Jackson2022-10-251-14/+59
| | | | | | | | | | | The explicit list of variant names, that needs to be kept in sync, and is a test failure semver break hazard, is now gone. All the necessary code is now generated automatically, and cannot be wrong. I want this because I find myself wanting to add a second implementation of FlagEvent, for another type.
* 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
|/
* 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-141-1/+1
|
* tor-dirmgr: Make DirStatus non-public.Nick Mathewson2022-06-141-3/+1
| | | | | 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-141-0/+96
| | | | | | | | | 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
|
* DirMgr: Track errors, stalls, and resets as part of status.Nick Mathewson2022-06-131-2/+47
| | | | | | | | | | | | | | 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-131-67/+56
| | | | | | | | | | | | | 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-131-48/+41
| | | | 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-131-34/+34
| | | | | | 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.
* tor-dirmgr: update status reporting to consider skew toleranceNick Mathewson2022-05-111-23/+66
| | | | | | In our status reporting code, we consider an expired-but-still-usable directory still bootstrapped, but not 100% bootstrapped.
* Merge branch 'disallowed_lint' into 'main'eta2022-03-301-1/+0
|\ | | | | | | | | Remove allow(clippy::disallowed_methods) lint flag. See merge request tpo/core/arti!437
| * Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-301-1/+0
| |
* | Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-301-20/+3
|/ | | | | | | | | | | | | | | The various background daemon tasks that `arti-client` used to spawn are now handled inside their respective crates instead, with functions provided to spawn them that return `TaskHandle`s. This required introducing a new trait, `NetDirProvider`, which steals some functionality from the `DirProvider` trait to enable `tor-circmgr` to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it can't depend on `DirProvider` directly). While we're at it, we also make some of the tasks wait for events from the `NetDirProvider` instead of sleeping, slightly increasing efficiency.
* Merge branch 'no-system-time' into 'main'eta2022-03-301-0/+1
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * use wallclock where possible in teststrinity-1686a2022-02-261-0/+1
| |
* | Move skip_fmt into tor-basic-utilsIan Jackson2022-03-041-1/+1
| | | | | | | | | | | | | | Code motion and the minimal mechanical changes. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
* | Replace manual Default impl with educe+std in tor-dirmgrIan Jackson2022-03-021-8/+4
| |
* | Replace manual Debug impl with educe in tor-dirmgrIan Jackson2022-03-021-8/+5
|/
* tor-dirmgr: Create a bootstrap-status exporting mechanism.Nick Mathewson2022-01-181-4/+465
| | | | | | | | | | | | | | | | | | | | | | 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.
* Refactor directory events to use a FlagPublisher mechanism.Nick Mathewson2021-12-141-86/+327
| | | | | | | | 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.