summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src
Commit message (Collapse)AuthorAgeFilesLines
* Use a lower default for max_retries.Nick Mathewson2022-03-301-1/+1
| | | | | | | | | | The older default seems (experimentally) to be ridiculously high. Generally, if we can't build a circuit within a handful attempts, that circuit has already timed out... unless there is a fast-failure condition, in which case we're just hammering the network (or our view of it.) Found with `arti-testing` for #329.
* circmgr: limit circuit attempts when launch_parallelism > 1.Nick Mathewson2022-03-301-1/+21
| | | | | | | | | | | Previously, if we had launch_parallelism > 1, and we were willing to retry building a circuit max_retries times, then we'd launch up to max_retries * launch_parallelism circuits before giving up. Ouch! With this patch, we try to keep the total number of circuits planned and attempted to the actual max_retries limit. Part of #329; found with arti-testing.
* Run cargo fmt one more time for good measure.Nick Mathewson2022-03-301-2/+2
|
* Refactor FirstHopId into type-differentiated formNick Mathewson2022-03-301-10/+22
| | | | | | | | | | | The FirstHopId type now records an enum that stores whether the hop is a guard or a fallback. This change addresses concerns about remembering to check the type or source of an Id before passing it down to the FallbackState or GuardSet. Making this change required an API change, so that dirmgr can report success/failure status without actually knowing whether it's using a fallback or a guard.
* Rename Guard=>FirstHop, GuardId=>FirstHopIdNick Mathewson2022-03-301-3/+3
| | | | | This is preparation for having separate GuardId and FirstHopId types that distinguish which back-end they index.
* DirPathBuilder::pick_path: re-order match cases for clarity.Nick Mathewson2022-03-301-16/+18
|
* Rename ExternalFailure => ExternalActivity.Nick Mathewson2022-03-301-3/+3
|
* Replace the fallback directories when they change in the config.Nick Mathewson2022-03-301-0/+5
| | | | | | The code here uses a new iterator type, since I couldn't find one of these on crates.io. I tried writing the code without it, but it was harder to follow and test.
* Add status tracking to FallbackDir.Nick Mathewson2022-03-301-0/+9
| | | | | | | | | | | We do this by creating a new FallbackSet type that includes status information, and updating the GuardMgr APIs to record success and failure about it when appropriate. We can use this to mark FallbackDirs retriable (or not). With this change, FallbackDir is now stored internally as a Guard in the GuardMgr crate. That's fine: the FallbackDir type really only matters for configuration.
* circmgr: Use guard-manager's view of the fallbacks when possible.Nick Mathewson2022-03-304-14/+49
| | | | | | | | | | | | | | | | | | If we're building a path with the guard manager involved, we now ask the guard manager to pick our first hop no matter what. We only pick from the fallback list ourselves if we're using the API with no guard manager. This causes some follow-on changes where we have to remember an OwnedChanTarget object in a TorPath we've built, and where we gain the ability to say we're building a path "from nothing extra at all." Those are all internal to the crate, though. Closes #220, by making sure that we use our guards to get a fresh netdir (if we can) before falling back to any fallbacks, even if our consensus is old. Compilation should be fixed in the next commit.
* Turn FallbackList into a real type, and store one in GuardMgr.Nick Mathewson2022-03-305-23/+30
| | | | | | | | | | | | | | The guard manager is responsible for handing out the first hops of tor circuits, keeping track of their successes and failures, and remembering their states. Given that, it makes sense to store this information here. It is not yet used; I'll be fixing that in upcoming commits. Arguably, this information no longer belongs in the directory manager: I've added a todo about moving it. This commit will break compilation on its own in a couple of places; subsequent commits will fix it up.
* Move fallback.rs into guardmgr.Nick Mathewson2022-03-304-4/+6
| | | | | | | This is the logical place for it, I think: the GuardMgr's job is to pick the first hop for a circuit depending on remembered status for possible first hops. Making this change will let us streamline the code that interacts with these objects.
* Merge branch 'disallowed_lint' into 'main'eta2022-03-302-5/+0
|\ | | | | | | | | Remove allow(clippy::disallowed_methods) lint flag. See merge request tpo/core/arti!437
| * Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-302-5/+0
| |
* | Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-301-3/+251
|/ | | | | | | | | | | | | | | 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-304-18/+44
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * typotrinity-1686a2022-02-281-1/+1
| |
| * use wallclock where possible in teststrinity-1686a2022-02-262-0/+5
| |
| * fix teststrinity-1686a2022-02-252-14/+21
| |
| * remove most usage of SystemTime::nowtrinity-1686a2022-02-254-4/+18
| |
* | Remove a now-irrelevant commentNick Mathewson2022-03-281-2/+0
| |
* | remove usage of 'token' where it's no longer a tokentrinity-1686a2022-03-272-13/+16
| |
* | implement IsolationHelper for StreamIsolationtrinity-1686a2022-03-252-14/+12
| | | | | | | | but don't use it in a dyn Isolation context
* | move StreamIsolation to isolation moduletrinity-1686a2022-03-243-108/+107
| |
* | implement IsolationHelper for tuple of IsolationHelpertrinity-1686a2022-03-241-0/+159
| |
* | move isolation in separate moduletrinity-1686a2022-03-245-330/+336
| |
* | seal trait Isolationtrinity-1686a2022-03-241-1/+11
| |
* | rename *_isolation_group to *_isolationtrinity-1686a2022-03-242-8/+8
| |
* | Merge branch 'more_iso_docs' into 'main'eta2022-03-231-7/+63
|\ \ | | | | | | | | | | | | Expand documentation for isolation traits See merge request tpo/core/arti!420
| * | Expand documentation for isolation traitsNick Mathewson2022-03-171-7/+63
| | | | | | | | | | | | | | | | | | | | | These aren't complete yet; I'm just making this commit to capture the notes we took on a pad when we were discussing these APIs. Part of #414.
* | | Expand some comments based on review from @diziet.Nick Mathewson2022-03-211-1/+4
| | |
* | | circmgr: When planning, only keep one error; log them all.Nick Mathewson2022-03-211-3/+6
| | |
* | | dirmgr: Note errors and inform the circmgr about them.Nick Mathewson2022-03-211-0/+11
| | | | | | | | | | | | | | | | | | Some error types indicate that the guard has failed as a dircache. We should treat these errors as signs to close the circuit, and to mark the guard as having failed.
* | | Expose more peer information from circuit build failuresNick Mathewson2022-03-212-9/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | We already have the ability to get peer information from ChanMgr errors, and therefore from any RetryErrors that contain ChanMgr errors. This commit adds optional peer information to tor-proto errors, and a function to expose whatever peer information is available.
* | | circmgr: Change API for using FallbackDirsNick Mathewson2022-03-213-6/+7
| | | | | | | | | | | | | | | | | | It'll soon more convenient to pass in FallbackDirs as a slice of references, rather than just a slice of FallbackDirs: I'm going to be changing how we handle these in tor-dirmgr.
* | | circmgr: use AllGuardsDown to retry betterNick Mathewson2022-03-212-8/+36
|/ / | | | | | | | | | | | | | | | | | | | | | | | | If all guards are down and they won't be retriable for a while, try waiting that long to get whichever guard _is_ retriable. Additionally, if we are making multiple circuit plans in parallel, only report our planning as having failed if we failed at making _all_ the plans. Previously we treated any failure as fatal for the other plans, which could lead to trouble in the case when guards were all down or pending. Part of #407.
* | Alternative API for set_isolation_group().Nick Mathewson2022-03-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Instead of requiring a `Box<dyn Isolation>`, it now takes either a `Box<dyn Isolation>`, or an arbitrary `T` that implements `Isolation`. This API still allows the user to pass in a `Box<dyn Isolation>` if that's what they have, but it doesn't require them to Box the isolation on their own. Part of #414.
* | Merge branch 'test-isolation' into 'main'Nick Mathewson2022-03-174-86/+370
|\ \ | | | | | | | | | | | | new api for isolation See merge request tpo/core/arti!377
| * | replace TODOs with documentationtrinity-1686a2022-03-161-1/+1
| | |
| * | add trait to help test isolation related codetrinity-1686a2022-03-163-49/+182
| | |
| * | add tests on Isolation and fix conditional compilation issuestrinity-1686a2022-03-161-0/+58
| | | | | | | | | | | | | | | | | | it seems I added conditional compilation without noticing it?? and there was some errors when choosing a prefered runtime depending on feature flags
| * | refactor restrict_muttrinity-1686a2022-03-161-14/+15
| | |
| * | replace Arc with Box and use dyn-clonetrinity-1686a2022-03-161-43/+24
| | | | | | | | | | | | this also removes JoinResult
| * | add some documentation for new traitstrinity-1686a2022-03-161-12/+18
| | |
| * | replace isolated with compatibletrinity-1686a2022-03-161-13/+13
| | | | | | | | | | | | the inverted logic was too easy to mess up
| * | use downcast-rs instead of our own AsAnytrinity-1686a2022-03-161-15/+3
| | |
| * | fix existing teststrinity-1686a2022-03-162-68/+62
| | |
| * | add a join() on Isolationtrinity-1686a2022-03-161-4/+65
| | |
| * | testing new api for isolationTrinity Pointard2022-03-162-9/+71
| | |
* | | Merge branch 'config-partials-transparent' into 'main'Ian Jackson2022-03-172-51/+48
|\ \ \ | |/ / |/| | | | | | | | Absolish builders for CircMgrConfig and DirMgrConfig See merge request tpo/core/arti!417