summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src
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-282-2/+2
| |
* | impl Debug for various internal typesIan Jackson2022-02-253-4/+25
|/ | | | | | | | 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.
* Merge remote-tracking branch 'origin/mr/340'Nick Mathewson2022-02-233-11/+21
|\
| * Make NoLock into BadApiUsage.Nick Mathewson2022-02-222-10/+14
| | | | | | | | | | | | To implement this, we had to refactor the tor_circmgr api for flushing state changes to disk, so that it checks if it has the lock, and only then tries to store.
| * Fold EK::Canceled into TransientFailureNick Mathewson2022-02-221-1/+7
| | | | | | | | Also add some TODO comments in circmgr for future work.
* | Merge branch 'restore_needless_borrow_check' into 'main'eta2022-02-231-1/+0
|\ \ | |/ |/| | | | | | | | | Remove clippy::needless_borrow exception in CI. Closes #310 See merge request tpo/core/arti!338
| * Remove clippy::needless_borrow exception in CI.Nick Mathewson2022-02-201-1/+0
| | | | | | | | | | This exception is no longer necessary now that the underlying CI bug is fixed.
* | Handle panics from circuit construction.Nick Mathewson2022-02-182-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | 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-177-71/+123
|\
| * Rename CircuitTimeout to TorNetworkTimeout.Nick Mathewson2022-02-171-2/+2
| |
| * tor_circmgr::Error: Sort variants by interesting-ness.Nick Mathewson2022-02-171-37/+37
| | | | | | | | We can't use discriminants here now, but maybe we can in the future.
| * tor-circmgr: errors: Use autoconversion for BugIan Jackson2022-02-171-2/+2
| |
| * Clarify and rename PendingCanceledNick Mathewson2022-02-162-8/+9
| | | | | | | | | | | | | | | | 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.
| * Provide a better ErrorKind from RetryError.Nick Mathewson2022-02-161-3/+26
| | | | | | | | (Instead of reporting the _last_ error, report the _worst_ error.)
| * circmgr: Add a Kind for speculative guard failure.Nick Mathewson2022-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | These errors should almost never be seen by the user; we should instead retry the circuit. But they _can_ be seen by the use if selecting a guard takes too long, or too many attempts. (Therefore, they aren't true "internal" errors.) I suspect that we might not want to keep this TransientFailure kind, but I'm not sure what else to do here for now.
| * Add kinds for *most* circmgr errors.Nick Mathewson2022-02-166-35/+57
| | | | | | | | There are a couple of tricky ones I'll do separately.
| * circmgr: Port InternalError to use Bug.Nick Mathewson2022-02-163-6/+12
| |
* | 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.
* Move persistent state flush from client to circmgrYuan Lyu2022-02-151-1/+13
|
* Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-141-1/+1
| | | | Closes #338.
* Add TODOs on uncertain points about time_since_last_trafficNick Mathewson2022-02-091-0/+1
| | | | | | This edge-case was there even before the migration of 595fe1ab881b94106649, but now it's more explicit and ought to be revisited.
* Remove the use of Mutex in channel unused_since timestampYuan Lyu2022-02-081-2/+6
|
* Tests for TargetPorts::display()Nick Mathewson2022-02-041-1/+12
|
* Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-042-13/+26
| | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)
* errors: Drop "Error" and "Failed" from various enum variantsIan Jackson2022-02-042-3/+3
|
* tor-circmgr: Introduce TargetPorts with a pretty Display implIan Jackson2022-02-042-2/+35
|
* tor-circmgr::Error: impl HasKindIan Jackson2022-02-041-0/+12
|
* tor-circmgr: Handle channel creation errors in the new styleIan Jackson2022-02-042-4/+19
|
* spawn errors: Fix arti-client, tor-chanmgr, tor-circmgrIan Jackson2022-02-041-3/+10
| | | | | | | Provide an enum variant to contain the SpawnError and a From impl. We use `#[from]` here because it doesn't really make sense to attach any context, as it's not likely to be very relevant.
* tor-circmgr: impl Display for TargetPortIan Jackson2022-02-041-0/+7
| | | | This will be used for error handling, and perhaps other things.
* 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-022-1/+2
| |
* | Untangle two needless Ok(r?) into just rIan Jackson2022-02-021-1/+1
|/ | | | | | Prompted by clippy::needless_question_mark. Sometimes Ok(r?) is needed to do automatic error conversion. I assume the lint checks for that. Anyway, in these cases it's not needed.
* Rename FooRuntime to FooNativeTlsRuntime for consistency.Nick Mathewson2022-01-261-1/+1
|
* Merge branch 'ticket255' into 'main'eta2022-01-241-1/+1
|\ | | | | | | | | | | | | Refactor our Runtime implementations to allow replacement parts Closes #255 See merge request tpo/core/arti!251
| * Refactor Runtimes to use separate TLS implementations internally.Nick Mathewson2022-01-191-1/+1
| | | | | | | | | | This will make it easier to implement them using some other TLS provider as well, without having to duplicate all of our code.
* | StreamPrefs: rename from ConnectPrefsIan Jackson2022-01-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The docs even say this is about stream. As @nickm writes in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771289 we generally call end-to-end connections that are tunneled over Tor "Streams" to distinguish them from everything else in the Tor protocols that could possibly be called a "Connection". That seems to apply here too.
* | Test for PathConfig::at_least_as_permissive_as().Nick Mathewson2022-01-201-0/+29
| | | | | | | | | | | | This is totally not just an exercise to get combined test coverage for tor-circmgr over 90% because I needed something to do that wouldn't distract anybody else. :)