aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-proto: add `NotSingleLegError` for `single_leg_check`Steven Engler2025-03-111-8/+34
|
* tor-rtmock: allow-Decorate every use of MockSleepProviderIan Jackson2025-03-061-0/+1
| | | | | | | MockSleepProvider and MockSleepRuntime have been declared deprecated by the docs for some time. We're about to mark them `#[deprecated]`. This commit has been split out for clarity of review.
* tor-proto: s/note/warning in function docs about locking stream map mutex.Gabriela Moldovan2025-03-061-1/+1
|
* tor-proto: s/has_first_hop/has_hops (fmt).Gabriela Moldovan2025-03-061-5/+1
|
* tor-proto: s/has_first_hop/has_hops.Gabriela Moldovan2025-03-063-3/+3
|
* tor-proto: Fix up docs post-refactoring (fmt).Gabriela Moldovan2025-03-061-4/+1
|
* tor-proto: Fix up docs post-refactoring.Gabriela Moldovan2025-03-061-3/+3
|
* tor-proto: Move Circuit to its own module.Gabriela Moldovan2025-03-069-1325/+1393
| | | | | | | | | | | This is mostly code motion + some visibility adjustments. Moving all of these outside of `reactor` makes it easier to see which parts are internal vs which are accessed by the reactor. It also helps us enforce/audit invariants such as 'there should be no contention on the `CircHop::map` mutex' (the stream map is now private to `reactor::circuit`, and therefore nothing inside `reactor` will be directly accessing it).
* tor-proto: Avoid accessing CircHop internals from the reactor.Gabriela Moldovan2025-03-063-2/+16
| | | | This will enable us to move `CircHop` out of `reactor.rs`.
* tor-proto: Avoid accessing Circuit internals from the reactor.Gabriela Moldovan2025-03-062-3/+16
| | | | This will enable us to factor `Circuit` out of `reactor.rs`.
* Merge branch 'ctrl-cmd-docs' into 'main'David Goulet2025-03-031-6/+5
|\ | | | | | | | | tor-proto: Update CtrlCmd and CtrlMsg docs. See merge request tpo/core/arti!2829
| * tor-proto: Update CtrlCmd and CtrlMsg docs.Gabriela Moldovan2025-03-031-6/+5
| | | | | | | | | | | | In aa08ede11fd483cd6dcb4522c431f9e07001717e, the reactor loop was rewritten to unconditionally read from the `CtrlMsg` channel, so we need to adjust the docs.
* | Merge branch 'conflux-cmds' into 'main'David Goulet2025-03-033-13/+73
|\ \ | | | | | | | | | | | | | | | | | | tor-proto: Add CtrlCmd:ShutdownAndReturnCircuit Closes #1876 See merge request tpo/core/arti!2831
| * | tor-proto: Add CtrlCmd::ShutdownAndReturn circuit.Gabriela Moldovan2025-03-031-0/+18
| | | | | | | | | | | | Closes #1876
| * | tor-proto: Add ConfluxSet method for taking the only leg in the set.Gabriela Moldovan2025-03-032-0/+28
| | | | | | | | | | | | | | | | | | | | | This will be used to implement the new `ShutdownAndReturnCircuit` control command. Part of #1876
| * | tor-proto: Use bad_api_usage! instead of internal! where applicable (fmt).Gabriela Moldovan2025-03-031-2/+6
| | |
| * | tor-proto: Use bad_api_usage! instead of internal! where applicable.Gabriela Moldovan2025-03-031-3/+3
| | | | | | | | | | | | | | | Some of these were supposed to be `bad_api_usage`, because they result from API misuse rather than an internal error (bug).
| * | tor-proto: Factor out conflux set length check to new function (fmt).Gabriela Moldovan2025-03-031-6/+6
| | |
| * | tor-proto: Factor out conflux set length check to new function.Gabriela Moldovan2025-03-031-3/+13
| | | | | | | | | | | | | | | This will enable us to reuse these checks for implementing other methods that are only supported if the conflux set has a single leg.
| * | tor-proto: Use handle_shutdown() when handling CtrlCmd::Shutdown.Gabriela Moldovan2025-03-031-1/+1
| |/ | | | | | | | | | | For consistency with the `CtrlCmd::Shutdown` handling from `Reactor::wait_for_create` (`handle_shutdown()` also prints a helpful trace log).
* / tor-proto: remove `Arc<AsyncMutex<_>>` in `Circuit::input`Steven Engler2025-03-032-27/+3
|/
* Merge branch 'conflux-poll-multiple' into 'main'gabi-2502025-03-032-64/+148
|\ | | | | | | | | | | | | tor-proto: Rewrite reactor loop to read from all circuits. Closes #1863 See merge request tpo/core/arti!2817
| * tor-proto: Document that ready_streams_iterator() is cancel-safe.Gabriela Moldovan2025-03-031-0/+2
| |
| * tor-proto: Add cancellation-safety note inside circuit_action().Gabriela Moldovan2025-03-031-0/+3
| |
| * tor-proto: Reduce select_biased! indentation.Gabriela Moldovan2025-02-271-21/+21
| | | | | | | | | | This was left over from the refactoring that moved the inner `select` into the `ConfluxSet` impl.
| * tor-proto: Rename SelectResult to CircuitAction.Gabriela Moldovan2025-02-272-13/+13
| |
| * tor-proto: Rewrite reactor loop to read from all circuits.Gabriela Moldovan2025-02-272-55/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit updates the `Reactor::run_once()` loop to attempt to read from (and write to) all of its circuit legs as opposed to just the primary one. Note that this slightly changes the behavior of the reactor. Previously, we'd only read from the control channel if the `chan_sender` was ready, whereas now the control channel is unconditionally read from, in the *outer* select. The overall effect is that the control channel can cause unbounded buffering in the `chan_sender` of each circuit (which can happen if the `chan_sender` is not ready to send). This was actually how the reactor worked before the refactoring from !2747, which is reflected in the `chan_sender` docs: ```rust /// Sender object used to actually send cells. /// /// NOTE: Control messages could potentially add unboundedly to this, although that's /// not likely to happen (and isn't triggereable from the network, either). chan_sender: SometimesUnboundedSink<AnyChanCell, ChannelSender>, ``` I don't believe this to be a problem, for the reason mentioned in the `chan_sender` docs, and because the main reason we check for `chan_sender` readiness is to apply backpressure on senders, which is not something we need to worry about when it comes to the control channel. Besides, the control channel is unbounded, so not reading from it won't stop the senders from sending more commands anyway. Closes #1863
| * tor-proto: Add a SelectResult::RemoveLeg command.Gabriela Moldovan2025-02-271-0/+6
| | | | | | | | | | This tells the reactor to remove a given circuit from the conflux set, and will be used to remove the circuits that have been shut down.
| * tor-proto: Add function for removing circuits from ConfluxSet.Gabriela Moldovan2025-02-271-1/+23
| |
* | tor-proto: Remove unnecessary async block (fmt).Gabriela Moldovan2025-02-271-42/+40
| |
* | tor-proto: Remove unnecessary async block.Gabriela Moldovan2025-02-271-3/+2
|/ | | | | `futures::future::poll_fn` returns a future, so the `async` block isn't actually necessary.
* Merge branch 'sync_datastream' into 'main'Nick Mathewson2025-02-271-6/+10
|\ | | | | | | | | | | | | Make DataStream, and its members, implement Sync. Closes #1859 See merge request tpo/core/arti!2808
| * Apply 1 suggestion(s) to 1 file(s)Nick Mathewson2025-02-271-1/+1
| | | | | | Co-authored-by: Ian Jackson <[email protected]>
| * Make DataStream, and its members, implement Sync.Nick Mathewson2025-02-261-6/+10
| | | | | | | | | | | | | | Also, use static_assertions to enforce that that they _stay_ Send+Sync. Closes #1859.
* | tor-proto: Add _mut suffix to functions returning mutable circs (fmt).Gabriela Moldovan2025-02-261-1/+5
| |
* | tor-proto: Add _mut suffix to functions returning mutable circs.Gabriela Moldovan2025-02-263-20/+20
| |
* | tor-proto: s/legs/leg in variable name.Gabriela Moldovan2025-02-261-2/+2
| |
* | tor-proto: Add TODO about removing CtrlMsg::SendSendme.Gabriela Moldovan2025-02-261-0/+2
| |
* | tor-proto: Update misleading comment about SENDMEs.Gabriela Moldovan2025-02-261-1/+2
| |
* | tor-proto: Make the reactor shut down when all the legs close.Gabriela Moldovan2025-02-262-1/+17
| |
* | tor-proto: Simplify expression using is_ok_and.Gabriela Moldovan2025-02-261-1/+1
| | | | | | | | As suggested by opara in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2804#note_3165059
* | tor-proto: Rename Circuit variable to circ.Gabriela Moldovan2025-02-261-4/+4
| | | | | | | | | | It used to be a Reactor, but the `reactor` variable name no longer makes sense.
* | tor-proto: Avoid using Reactor in the circuit extender.Gabriela Moldovan2025-02-262-12/+9
| | | | | | | | | | | | This helps us get rid of some unnecessary error handling. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2804#note_3165058
* | tor-proto: Begin documenting the circuit removal behavior.Gabriela Moldovan2025-02-261-1/+17
| |
* | tor-proto: Forbid CtrlMsg::Extend* on multipath tunnels.Gabriela Moldovan2025-02-251-0/+20
| | | | | | | | We definitely don't want to ever allow this.
* | tor-proto: Avoid panicking on double CtrlMsg::Create.Gabriela Moldovan2025-02-252-16/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, sending two `CtrlMsg::Create` to the reactor would cause it to panic. This makes it so that the double `Create` just leads to the caller receiving an error response via the completion channel. Note: this was not triggerable via the network, only via the tor-proto API. Moreover, the panic was unreachable from the public client API, because the `PendingClientCirc`/`ClientCirc` typestate makes it impossible to send a second `Create` (the `PendingClientCirc` becomes `ClientCirc` after the `Create` completes, and `PendingClientCirc` doesn't have an API for sending `Create` control messages to the reactor).
* | tor-proto: Update docs to refer to Circuit instead of Reactor.Gabriela Moldovan2025-02-251-3/+3
| |
* | tor-proto: Add some more conflux-related TODOs.Gabriela Moldovan2025-02-251-0/+10
| |
* | tor-proto: Use a ConfluxSet in the circuit reactor.Gabriela Moldovan2025-02-254-48/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first step toward supporting traffic splitting in the circuit reactor. While the logic has changed slightly to support handling circuits instead of just one, the reactor still only supports `ConfluxSet`s of size 1, so this should effectively be a no-op. In the future, this code will be extended to support the conflux-specific cells and to implement the conflux proto. The code uses `ConfluxSet::primary_leg()` and `ConfluxSet::single_leg()` somewhat interchangeably. This is not *currently* a problem because`primary_leg()` is the same as `single_leg()` for single path tunnels, but we will need to adjust some of these call sites when we add support for multipath tunnels (I have left a `TODO(conflux)` for every dubious call site). This commit also makes `CtrlMsg::FirstHopClockSkew` fallible: if the reactor is multipath, it will return `Err(Bug(..))` to the caller (this error is returned to the caller over the `answer` channel; it does *not* shut down the reactor)
* | tor-proto: Add a ConfluxSet type.Gabriela Moldovan2025-02-252-0/+77
| |