summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/circuit
Commit message (Collapse)AuthorAgeFilesLines
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-0/+3
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* proto: Fix up doc links post-refactoringGabriela Moldovan2025-11-171-7/+7
|
* proto: Temporarily silence a few warningsGabriela Moldovan2025-11-171-0/+3
|
* proto: Make cc state shared between CircHop{Inbound,Outbound}Gabriela Moldovan2025-11-171-14/+20
| | | | | | | | | | | | | The relay reactor needs the cc state to be shared between the inbound and outbound components (i.e. the forward and backward reactors), so we need to put the cc state behind a mutex. There will never be any contention on this mutex in the client impl, because the client reactor doesn't split the `CircHop` into `CircHopInbound` and `CircHopOutbound`. In the future, we should work on trying to reduce the number of locks in the `CircHop` states.
* proto: Move CircHop{Inbound,Outbound} out of the client module.Gabriela Moldovan2025-11-171-2/+590
| | | | These will be soon used by relays too.
* proto: Make the hop in SendRelayCell optionalGabriela Moldovan2025-11-171-2/+2
|
* proto: Update SendRelayCell docsGabriela Moldovan2025-11-171-2/+3
|
* proto: Move SendRelayCell to circhop (fmt)Gabriela Moldovan2025-11-171-2/+2
|
* proto: Move SendRelayCell to circhopGabriela Moldovan2025-11-171-2/+16
| | | | | This will be used by relays too, once we modify it to make the `HopNum` optional.
* Merge branch 'cell-sender' into 'main'Alexander Hansen Færøy2025-11-101-0/+301
|\ | | | | | | | | proto: Move cell_sender out of the client module See merge request tpo/core/arti!3407
| * proto: Move cell_sender out of the client moduleGabriela Moldovan2025-10-281-0/+301
| | | | | | | | | | | | | | Soon we'll use CircuitCellSender in the relay reactor too (we need to, because it provides a useful abstraction for handling block/unblock padding actions, and because it has some handy helper functions such as `congestion_signals()`).
* | Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | | | | | Run maint/add_warning
* | proto: Move a TODO to CircSyncViewGabriela Moldovan2025-10-301-0/+3
| |
* | proto: Add a new CircSyncView typeGabriela Moldovan2025-10-301-0/+38
|/ | | | | | This will replace ClientCircView in the IncomingStreamRequestFilter APIs, which will enable us to use IncomingStreamRequestFilter for incoming streams on the exit side too.
* proto: Move hop settings into a shared moduleGabriela Moldovan2025-10-211-0/+241
|
* proto: Move celltypes out of clientGabriela Moldovan2025-10-131-0/+181
| | | | | Some of these are relay-specific, so it makes more sense to pull this into a top-level module.
* proto: Add a circuit module shared between client and relay impls.Gabriela Moldovan2025-08-281-0/+50
| | | | | | | This is just code motion (I suggest reviewing with `--color-moved`). This also moves the implementation-agnostic parts from `tor_proto::client::circuit` to a new `tor_proto::circuit` module.
* tor-proto: Add a tunnel module.David Goulet2025-02-2013-4203/+0
| | | | | | | | | | | | | 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-202-10/+10
| | | | | | | 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-182-1/+66
| | | | | This moves the `CreateHandshakeWrap` and its implementors to `reactor::create` (none of these are used outside of the reactor).
* 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: add `ClientCirc::first_hop_clock_skew`Steven Engler2025-02-102-0/+19
|
* 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: 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-062-137/+156
| | | | | | | 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-062-21/+52
|
* 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-043-73/+4
| | | | | | | | | | | | | | | | | | | 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: 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
|
* tor-proto: Rewrite circuit reactor run_once() loop to use select!.Gabriela Moldovan2025-01-295-205/+643
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This rewrites the circuit reactor main loop to use `select_biased!` to poll multiple futures simultaneously. The new `run_once()`, like the old, first waits for an initial `CtrlMsg::Create`. Then, it uses a `select_biased!` to poll the `chan_sender` sink and shutdown channel for readiness. When the channel sink is ready, we poll the `control` and `input` channels like before, as well as the new `ready_streams` `Stream` (`ready_streams` is a `futures::Stream` that replaces the previous `send_outbound()` function). Most of the implementation remains unchanged, except the `handle_input`, `handle_cell` and `handle_control` functions no longer send anything on the `chan_sender` channel. Instead, they may do some (synchronous) processing, and send instructions for the remaining work that needs to be done (for example, for writing the cell to the `chan_sender` channel). These instructions are handled at the end of `run_once()`, and are encoded in the `RunOnceCmdInner` enum. What this change does **not** do: * the control channel *still* bypasses congestion control. We could fix this by making the various reactor functions send the `RunOnceCmdInner` commands to `run_once()` via a channel (instead of returning them). This would enable the reactor to stop reading the commands (except for handle `Sendme`, which would be handled separately) if it's blocked on congestion control.
* tor-proto: Use SendRelayCell within CtrlMsg::SendRelayCell.Gabriela Moldovan2025-01-292-6/+5
|
* tor-proto: Add enums for representing run_once() commands.Gabriela Moldovan2025-01-291-0/+104
|
* tor-proto: Move SendMsgAndInstallHandler handling to a separate function.Gabriela Moldovan2025-01-291-13/+24
|
* tor-proto: Move the CircuitExtender to a separate module.Gabriela Moldovan2025-01-292-266/+295
|
* tor-proto: Move CtrlMsg to its own module.Gabriela Moldovan2025-01-292-181/+209
| | | | No functional changes, just code motion.