summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/mgr.rs
Commit message (Collapse)AuthorAgeFilesLines
* resolve commenttrinity-1686a2022-02-281-1/+6
|
* add some error to retry_error instead of dropping ittrinity-1686a2022-02-281-45/+45
|
* Merge branch 'teardown' into 'main'Nick Mathewson2022-02-281-1/+12
|\ | | | | | | | | | | | | tor-circmgr: take_action: Handle Cancelled from the oneshot Closes #365 See merge request tpo/core/arti!363
| * Add a debug! log message for source cancellationIan Jackson2022-02-281-0/+4
| |
| * Fix rustfmtIan Jackson2022-02-281-1/+1
| |
| * tor-circmgr: take_action: Handle Cancelled from the oneshotIan Jackson2022-02-251-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #365 Inspection of the code and logs shows that: * One of the plan futures' oneshots must be returning Cancelled * This means that the corresponding sender must have been dropped * The sender is owned by the task spawned by spawn_launch Presumably that entire task gets dropped as part of executor shutdown, or something. The correct response in this situation is to declare that we are shutting down, and stop trying to do stuff. Unfortunately, despite trying quite hard by putting sleeps in various strategic places, I have not been able to reproduce the problem. So I can't be 100% sure that the new behaviour is correct. But I am reasonably confident that this ought not to be able to occur unless either 1. the task from spawn_launch is dropped, or 2. that task somehow panics despite its attempts to trap panics and report them as errors through the oneshot. So this "burn it all down" action ought only to occur in actually serious situations. I observe that 3ff9b187ea26aaec4875067fcdbf485ecc9f597d Handle panics from circuit construction. changed the EK for PendingCanceled to EK::ReactorShuttingDown, and there's From impl. I think, therefore, that it is right to reuse this Error variant. I don't quite understand why when take_action gets an actual error it doesn't push it, but just logs it. But I am not changing that for now. Arguably the two instances of retry_error.push are a sign of an inferior flow control pattern - maybe the loop body including the code I am adding ought to be an IEFE returning `Result<Option<circ>, crate::Error>`.
* | Merge branch 'fix/210' into 'main'Nick Mathewson2022-02-281-1/+1
|\ \ | | | | | | | | | | | | | | | | | | don't return already errored pending circuit when searching new circuit matching spec Closes #210 See merge request tpo/core/arti!366
| * | don't return already errored pending circuit when searching new circuit ↵trinity-1686a2022-02-271-1/+1
| |/ | | | | | | matching spec
* | Fix two typosNick Mathewson2022-02-281-1/+1
| |
* | impl Debug for various internal typesIan Jackson2022-02-251-3/+12
|/ | | | | | | | I wanted this while debugging something. The ad-hoc impl Debug with f.debug_struct is getting repetitive and I've already perpetrated one copy-paste mistake. We should consider using something like the `educe` crate's Clone.
* Handle panics from circuit construction.Nick Mathewson2022-02-181-1/+12
| | | | | | | | | | | | We handle them by reporting them to task that's waiting for the circuit, then relaying the panic. Doing so allows the waiting task to distinguish panics (EK::Internal) from cases where the reactor dropped the task entirely (EK::ReactorShuttingDown). And doing _that_ removes one case of EK::Canceled, which helps us on our goals towards #348. Closes #347.
* Move the main body of our circuit-launching task into a new functionNick Mathewson2022-02-181-47/+55
| | | | This reduces our nesting, and will help us handle panics.
* Merge branch 'remaining-errors'Nick Mathewson2022-02-171-6/+7
|\
| * Clarify and rename PendingCanceledNick Mathewson2022-02-161-2/+2
| | | | | | | | | | | | | | | | From its old name, this error had implied that we were giving no useful information when we were waiting on a pending cirucit request that failed. In fact, this error would only happen if we dropped the `mpsc::Sender` for a circuit attempt without reporting success or failure.
| * Add kinds for *most* circmgr errors.Nick Mathewson2022-02-161-4/+5
| | | | | | | | There are a couple of tricky ones I'll do separately.
* | Add a comment about "&mut [&mut ]"Ian Jackson2022-02-171-0/+1
| |
* | Re-enable clippy::ptr_arg where it had been disabled.Nick Mathewson2022-02-161-2/+2
|/ | | | | | | | | | In one of the two places, nightly no longer warns. In the other place, it's fine for nightly to warn: I just fixed the code to take a slice instead. Partial revert of 856aca879151c622512bc4b15c6307808fc83e82. Resolves part of #310.
* tor-circmgr: Turn a type annotation comment into codeIan Jackson2022-02-041-2/+1
| | | | | | | | The type annotation may not be necessary for inference, but as a comment it risks becoming false. So it should be uncommented, or deleted. Error types round here are not entirely trivial so uncomment it.
* Merge branch 'typos' into 'main'eta2022-02-031-1/+1
|\ | | | | | | | | Fix typos See merge request tpo/core/arti!285
| * Fix typosDimitris Apostolou2022-02-021-1/+1
| |
* | Temporarily disable some clippy lints on nightlyIan Jackson2022-02-021-1/+1
|/
* circmgr: Fix a pair of clippy warnings.Nick Mathewson2022-01-071-2/+2
|
* tor-circmgr: Remove Arc around ClientCircIan Jackson2022-01-071-11/+11
| | | | | | See the new commentary text on `ClientCirc` for the rationale. Signed-off-by: Ian Jackson <[email protected]>
* tor-circmgr: tests: Do fake circuit equality by idIan Jackson2022-01-071-2/+2
| | | | | | | | | We are going to get rid of the Arc. Happily there is an id which is always constructed uniquely and preserved by clone. (auto-deref lets us make the function take &Self instead of &Arc) Signed-off-by: Ian Jackson <[email protected]>
* tor-circmgr: tests: Introduce and use FakeCirc::eq()Ian Jackson2022-01-071-13/+19
| | | | | | This removes a lot of open-coded Arc::ptr_eq() calls Signed-off-by: Ian Jackson <[email protected]>
* tor-circmgr: Replace some Arc::clone with .clone()Ian Jackson2022-01-071-5/+5
| | | | | | This will make the code work when it's not an Arc any more. Signed-off-by: Ian Jackson <[email protected]>
* tor-circmgr: Require that AbstractCirc are CloneIan Jackson2022-01-071-1/+1
| | | | | | | We are going to get rid of a lot of Arc, so we need the underlying thing to be Clone. Signed-off-by: Ian Jackson <[email protected]>
* Remove XXXs from tor-circmgr::mgrNick Mathewson2021-12-201-4/+0
| | | | | | IIUC, these anticipatd a need to store min_exit_circs_per_port in CircMgr. But the current design, where it goes into preemptive.rs and thence to usage, seems to work fine.
* Do not treat spawn failure as a fatal error.Nick Mathewson2021-12-151-12/+12
|
* Expand some comments about circuit expiration.Nick Mathewson2021-12-151-4/+9
| | | | | Emphasize that circuit expiration functions _decide whether to expire the circuit_, and don't expire it automatically.
* Add spawn_expiration_task function in circuit managerYuan Lyu2021-12-151-23/+103
|
* Make circuit_timing reconfigurable.Nick Mathewson2021-12-071-12/+18
|
* Allow on-the-fly changing of path_rulesNick Mathewson2021-12-071-7/+33
| | | | | | | | | | | | And now the complexity begins: when the user changes the path_rules, they not only want new circuits to obey those rules: they want _all new requests_ to be put onto circuits that obey those rules. That means that when the path rules become more restrictive, we need to retire all the circuits, and make sure that currently pending circuits aren't used for any requests. If it's any comfort, doing this was even more complicated in C tor. ;)
* Sketch API for reconfiguration.Nick Mathewson2021-12-071-0/+7
| | | | | | | This patch doesn't actually make anything reconfigurable, but it does create an API that will tell you "you can't change the value of that!" If the API looks reasonable, I can start making it possible to change the values of individual items.
* Allow configurability on preemptive circuitsNeel Chauhan2021-12-071-3/+11
|
* Merge remote-tracking branch 'origin/mr/154'Nick Mathewson2021-11-301-24/+195
|\
| * Add tests & address review commentaryeta2021-11-301-7/+155
| |
| * Introduce PreemptiveCircuitPredictor and TargetCircUsage::Preemptiveeta2021-11-231-23/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for making Arti build circuits preemptively, this commit introduces `TargetCircUsage::Preemptive`, a circuit usage that works somewhat differently from other ones: it requires at least 2 circuits to exist that can exit the port it contains in order for an existing circuit to match against it (path-spec.txt § 2.1.1); if that's not the case, that usage will require building new circuits (in order that we build enough to have 2 available). This required refactoring how circuit reuse worked; now, `CircList::find_open` uses the new `AbstractSpec::find_supported` trait method, which we customize to implement the above check in the case of `Preemptive` circuit usages. To make that work, `OpenEntry` now takes two type parameters (the spec and circuit types), instead of taking a builder type parameter and using its associated types. (We also got rid of type constraints on that struct, yay!) A WIP implementation of a preemptive circuit predictor that implements path-spec.txt § 2.1.1 is also included, but this will require additional effort to wire it up with the `CircMgr` properly.
* | Merge remote-tracking branch 'origin/mr/148'Nick Mathewson2021-11-291-10/+2
|\ \
| * | In struct PendingEntry, remove circ_specNeel Chauhan2021-11-281-10/+2
| |/
* | add semicolons if nothing returnedDaniel Eades2021-11-251-3/+3
| |
* | deglob some enums, use concise iteration syntaxDaniel Eades2021-11-251-1/+1
|/
* Fold "circuit_timing" and "request_timing" into a single section.Nick Mathewson2021-11-181-30/+7
|
* Replace all println/eprintln calls outside of arti CLI with trace.Nick Mathewson2021-11-041-1/+2
|
* Mark request_retried test as ignoredNick Mathewson2021-10-281-0/+1
|
* circmgr: Split request_timeout test into two.Nick Mathewson2021-10-261-0/+7
| | | | | | | There seems to be some issue here with the new WaitFor code, where using the same MockSleepProvider with both of these wait_for() calls gives questionable behavior under some circumstances (like when running under Tarpaulin with the wrong set of flags).
* Overhaul the way WaitFor and the MockSleepProvider worketa2021-10-261-7/+51
| | | | | | | | | | | | | | | | | | | | | Instead of racily advancing time forward, this commit attempts to rework how WaitFor works, such that it makes advances when all sleeper futures that have been created have been polled (by handing the MockSleepRuntime a Waker with which to wake up the WaitFor). The above described mechanics work well enough for the double timeout test, but fail in the presence of code that spawns asynchronous / background tasks that must make progress before time is advanced for the test to work properly. In order to deal with these cases, a set of APIs are introduced in order to block time from being advanced until some code has run, and a carveout added in order to permit small advances in time where required. (In some cases, code needed to be hacked up a bit in order to be made properly testable using these APIs; the `MockablePlan` trait included in here is somewhat unfortunate.) This should fix arti#149.
* Implement the "request_loyalty" configuration optionNick Mathewson2021-10-191-2/+1
|
* Do not use set_ prefix on derive_builder settersJani Monoses2021-09-161-1/+1
|
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|