aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | tor-proto: Move most of the reactor impl to Circuit (fmt).Gabriela Moldovan2025-02-252-8/+24
| |
* | tor-proto: Move most of the reactor impl to Circuit.Gabriela Moldovan2025-02-254-70/+60
| | | | | | | | | | | | | | This is an intermediate step in rewriting the reactor to manage a "conflux set" (a set of linked circuits) rather than a single circuit. This commit contains no functional changes.
* | tor-proto: Factor out stream management functionality.Gabriela Moldovan2025-02-252-21/+43
| | | | | | | | | | These will soon be functions on `Circuit`, so it's a good time to pull them out of the reactor impl.
* | tor-proto: Shuffle reactor impl in preparation for refactoring.Gabriela Moldovan2025-02-251-466/+466
| | | | | | | | | | | | | | | | | | This reorders the functions from the `Reactor` implementation in preparation for moving some of them to `Circuit`. This commit contains no functional changes and should be reviewed with `git diff --color-moved`. A future commit will move part of the `Reactor` impl block to `Circuit`.
* | tor-proto: Move cell handlers into a separate type (fmt).Gabriela Moldovan2025-02-251-3/+10
| |
* | tor-proto: Move cell handlers into a separate type.Gabriela Moldovan2025-02-252-44/+56
| | | | | | | | | | I am moving these handlers into a separate type because they'll need to be shared with the active `Circuit`, for handling incoming cells.
* | tor-proto: Add a reactor-internal Circuit type.Gabriela Moldovan2025-02-251-0/+38
| | | | | | | | | | | | | | | | | | This represents a circuit "leg", in the conflux sense. The `Circuit` type will be a helper for implementing tunnel reactors that contain multiple `Circuit`s forming a conflux set. The fields from `Circuit` were extracted from the `Reactor` struct. A future commit will part of the `Reactor` implementation to `Circuit`.
* | tor-proto: Add line breaks between impl blocks.Gabriela Moldovan2025-02-251-0/+4
| | | | | | | | For readability
* | tor-proto: Implement From<Bug> for ReactorError.Gabriela Moldovan2025-02-251-1/+6
|/ | | | | | | | | | We will soon have a `ConfluxSet` type. Some of its operations will return `Bug` (for example, the method for getting the *only* leg of the conflux set will return a `Bug` if the set has no legs, or more than 1 leg). This conversion function will make it easier these errors to `ReactorError`.
* tor-proto: add variants to `HopLocation` behind `conflux` featureSteven Engler2025-02-242-7/+10
|
* tor-proto: add `HopLocation` and `TargetHop`Steven Engler2025-02-241-0/+29
|
* tor-proto: Add a tunnel module.David Goulet2025-02-2027-210/+242
| | | | | | | | | | | | | Move StreamTarget to the tunnel module and the circuit module. From now on streams will be implemented on tunnels, not circuits. This moves `StreamTarget` to the tunnel module. A future change will replace `ClientCirc` with `ClientTunnel` inside `StreamTarget`. This is mostly code motion, best reviewed with `--color-moved`. Signed-off-by: David Goulet <[email protected]>
* tor-proto: Change the visibility of a series of structGabriela Moldovan2025-02-203-17/+17
| | | | | | | We're about to need this in `tor_proto::tunnel` which is from the Conflux work. In the spirit of upstreaming as much as possible, it is done now.
* tor-proto: Add a newtype wrapper for LegId.Gabriela Moldovan2025-02-201-4/+12
| | | | | We will eventually need to expose this in `tor-proto`'s public API, so it'll need to be an opaque type.
* tor-proto: Add LegId type that can be used as a slotmap key.Gabriela Moldovan2025-02-201-0/+8
| | | | | This will soon be used by the reactor-internal `ConfluxSet` as a unique identifier for the circuit legs stored in its `SlotMap`.
* tor-proto: Move CreateHandshakeWrap to reactor module (fmt).Gabriela Moldovan2025-02-181-3/+1
|
* tor-proto: Move CreateHandshakeWrap to reactor module.Gabriela Moldovan2025-02-183-57/+67
| | | | | This moves the `CreateHandshakeWrap` and its implementors to `reactor::create` (none of these are used outside of the reactor).
* tor-proto: Remove deprecated DataStream API.Gabriela Moldovan2025-02-131-32/+0
| | | | | Reducing `ClientCirc` proliferation will make our lives easier when implementing !2790.
* tor-proto: Fold the CommandHandler into ControlHandler.Gabriela Moldovan2025-02-112-95/+79
| | | | | | | | This gets rid of a bit of a duplicated code. It also moves `CtrlCmd` closer to `CtrlMsg`. Offshoot from my WIP conflux branch for #1838
* tor-proto: remove `ClientCirc::channel`Steven Engler2025-02-101-26/+2
|
* tor-proto: add `ClientCirc::first_hop_clock_skew`Steven Engler2025-02-103-0/+33
|
* conflux: Split off `time_provider` from `channel` in `ClientCirc`Neel Chauhan2025-02-101-2/+7
|
* tor-proto: Remove unnecessary param in handshake handler (fmt).Gabriela Moldovan2025-02-061-12/+3
|
* tor-proto: Remove unnecessary param in handshake handler.Gabriela Moldovan2025-02-062-6/+2
| | | | | | | | | The `Reactor` argument is never used, so we can just remove it from the trait. Removing this arg also simplifies #1838 for me (I am moving some code around, and the calls to `handle_sever_aux_data` no longer have access to the `Reactor`).
* tor-proto: remove `use asynchronous_codec as futures_codec`Neel Chauhan2025-02-063-18/+18
| | | | Closes #1690.
* tor-proto: Make ControlHandler::handler return non-optional result.Gabriela Moldovan2025-02-062-14/+14
| | | | | | The commands for which the function returned `Ok(None)` have been refactored into `CtrlCmd`, so we no longer need `handle()` to return an `Option`.
* tor-proto: Turn some CtrlMsgs into CtrlCmds.Gabriela Moldovan2025-02-063-147/+166
| | | | | | | All `CtrlMsg`s to which the reactor did not respond by sending a cell down the channel are now `CtrlCmd`s. Most of this is code motion, best reviewed with `--color-moved`.
* tor-proto: Make shutdown a CtrlCmd.Gabriela Moldovan2025-02-063-26/+58
|
* proto: Fix feature gated importDavid Goulet2025-02-041-2/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Move the begin cell handling into CircHopDavid Goulet2025-02-042-47/+38
| | | | | | | Move the BEGIN cell handling into CircHop following the previous commit that move more code into CircHop. Signed-off-by: David Goulet <[email protected]>
* proto: Move the close stream action into CircHopDavid Goulet2025-02-041-51/+55
| | | | | | | | | | | | | | | | | This is the first commit of a series to make CircHop own the code of its related actions. This commit moves the "close stream" code into CircHop now owning the action and offloading the Reactor code. In order to do this, and future changes like for example handling BEGIN, the CircHop needs to be aware of its hop number. This change also allows us to add the hop number to logging. It also copies the reactor unique ID to each hop for logging purposes. Future commit will continue to move more code into CircHop. Signed-off-by: David Goulet <[email protected]>
* proto: Remove ConversationInHandlerDavid Goulet2025-02-044-114/+5
| | | | | | | | | | | | | | | | | | | It is unused but most importantly it allows any RELAY cell to be sent from anywhere in the code which is really not desirable because it is skipping congestion control. It also allows us to remove the `control_tx` from the reactor which is one less channel to track/understand/think about. This opens up the door to all sorts of problems especially side channel that can be exploited if we are not careful. We can always bring this back if we need it but for now, it is unused and allows us to remove the `CtrlMsg::SendRelayCell` control message. No code behavior change. Signed-off-by: David Goulet <[email protected]>
* proto: Introduce a reactor ControlHandlerDavid Goulet2025-02-042-223/+248
| | | | | | | | | | | | | This object only mission is to handle a control message (CtrlMsg). It encapsulates a reference to the reactor and its lifetime is only the time it takes to handle the message. Main goal of this is to try to reduce reactor.rs size into logical containers. No code behavior change. Signed-off-by: David Goulet <[email protected]>
* tor-proto: Ensure rx end of chan reactor output sink is not dropped in test.Gabriela Moldovan2025-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This hopefully fixes #1832. I haven't been able to repro the failure from #1832 locally, but judging from the logs, I suspect it's triggered by interleavings like: - `extend_fut` executes up until `circ.extend_ntor(..).await`, where it's blocked `await`ing a completion notification from the circuit reactor - `reply_fut` starts running: * `CircuitExtender` installs a meta-handler in the circuit reactor, and waits for an `EXTENDED2` cell * `test_extend()` reads a cell from the receiving end of the fake channel's output sink (`rx`) * `test_extend()` sends the `EXTENDED2` cell to the circuit reactor over `CircuitRxSender` * `rx` is dropped - `reply_fut` completes - in the channel reactor's `run_once()`, `select_biased!` resolves to an error, because the receiving end of the `output` sink (`rx`) was dropped. The reactor logs `got sink error: SendError { kind: Disconnected }` (see [`SendError`]), and exits - the circuit reactor exits too, because the receiving end of its `chan_sender` (which was in the channel reactor) was dropped Returning the `rx` of the fake channel's output sink from `reply_fut` *should* stop it from being dropped, and fix #1832. [`SendError`]: https://docs.rs/futures/latest/futures/channel/mpsc/struct.SendError.html#method.is_disconnected
* Merge branch 'proto-datactl-api-fixes2' into 'main'Nick Mathewson2025-01-303-29/+28
|\ | | | | | | | | tor-proto: Tweak StreamCtrl APIs for RPC. See merge request tpo/core/arti!2755
| * proto: deprecate DataStream::circuitNick Mathewson2025-01-301-0/+4
| | | | | | | | | | | | | | | | This method is experimental, so no semver note is needed. It is redundant with `client_stream_ctrl()?.circuit()?`. (The name and the unconditional return type of this method are probably an error.)
| * proto: Rename (experimental) DataStream functions for ctrl accessNick Mathewson2025-01-301-6/+6
| | | | | | | | | | Since these return a client-specific type, they need a client-specific name before we can stabilize them for RPC.
| * proto: Rename ClientDataStreamCtrl::{is_open=>is_connected}Nick Mathewson2025-01-301-5/+2
| | | | | | | | | | | | | | Semantically, the new name matches the behavior much better. (A stream could well count as open if we had sent a RESOLVE but not received a RESOLVED, so we might someday want to have an `is_open` defined for _all_ streams, not just data streams.)
| * proto: Rename DataStreamCtrl to ClientDataStreamCtrlNick Mathewson2025-01-302-17/+17
| | | | | | | | | | | | The API for this type, and the fact that it implements ClientStreamCtrl unconditionally, means that it is only for client DataStreams.
| * proto: Clarify applicability of ClientStreamCtrl.Nick Mathewson2025-01-301-4/+2
| |
* | Merge branch 'reactor-stuff' into 'main'David Goulet2025-01-307-757/+1182
|\ \ | |/ |/| | | | | tor-proto: Rewrite circuit reactor run_once() loop to use select!. See merge request tpo/core/arti!2747
| * tor-proto: Remove outdated docs about AsyncMutex use.Gabriela Moldovan2025-01-301-7/+0
| |
| * tor-proto: Remove unnecessary time_prov argument.David Goulet2025-01-301-28/+17
| |
| * tor-proto: Remove unnecessary Mutex around chan_sender.David Goulet2025-01-301-44/+20
| |
| * tor-proto: Resolve clippy warning about mut refs in debug_assert.Gabriela Moldovan2025-01-291-6/+7
| | | | | | | | | | | | It's unclear to me why this warning didn't fire before! The the circuit reactor had this exact same `debug_assert` prior to the refactoring, taking a mutable reference to the `StreamMap`.
| * tor-proto: Add a clippy allow and corresponding TODO.Gabriela Moldovan2025-01-291-0/+1
| |
| * tor-proto: Remove now-unused Reactor::send_outbound().Gabriela Moldovan2025-01-291-74/+0
| | | | | | | | This is now handled in `Reactor::ready_streams_iterator()`.
| * tor-proto: Remove old Reactor::run_once().Gabriela Moldovan2025-01-291-66/+0
| | | | | | | | | | | | | | | | | | This is replaced by the new `Reactor::run_once()` impl. Note: this removal is in a separate commit to make the diff of the refactoring commits easier to review (the diff between the old and the new impl is not meaningful because the new impl is practically a rewrite).
| * tor-proto: Remove now-unused CellStatus enum.Gabriela Moldovan2025-01-291-9/+0
| | | | | | | | This is replaced by `Option<RunOnceCmdInner>`.
| * tor-proto: Rewrite circuit reactor run_once() loop to use select! (fmt).Gabriela Moldovan2025-01-292-27/+29
| |