summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/client
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: fix comment related to validating stream messagesSteven Engler2025-09-301-3/+4
| | | | | | | | | | I don't think the previous comment is correct. The main flow control checks are about receiving SENDME/XON/XOFFs, and ensuring that we don't receive too many of them. This all happens in the reactor. In theory the stream should be checking that we don't receive too many DATA messages for how many stream SENDMEs we've sent. But this is broken due to arti#2100. We do check this in the halfstream code though.
* padding: Remove post-queue blocker.Nick Mathewson2025-09-302-36/+26
| | | | | | | We no longer want to _ever_ block non-DATA cells, per discussion in circuit-padding.md. Closes #2190.
* padding: be less dogmatic in a TODO about where a buffer would go.Nick Mathewson2025-09-301-4/+4
|
* Sort output events for next_circ_action.Nick Mathewson2025-09-291-1/+48
| | | | | | | | This sort makes it so that that blocking and unblocking are always ordered in a sensible way with respect to sending data. This might help simplify padding machines a bit. Prerequisite for #2190
* proto: Replace magic value with constant (fmt).Gabriela Moldovan2025-09-251-1/+2
|
* proto: Replace magic value with constant.Gabriela Moldovan2025-09-251-4/+9
| | | | | Also derives `CIRC_ACTION_COUNT` from the two other constants instead of hard-coding the value.
* proto: Use MAX_CONFLUX_LEGS instead of magic number.Gabriela Moldovan2025-09-251-1/+2
| | | | | Besides, it's better if we use the same number for the expected number of legs as we do in the conflux set impl.
* proto: Make padding and timeout actions take priority.Gabriela Moldovan2025-09-251-34/+69
| | | | | | | | | | This rewrites `next_circ_action()` yet again, using two layers of `PollAll`: * the inner layer drives an individual circuit leg. Each circuit has a `PollAll` that drives its futures * the outer layer drives the inner `PollAll`s belonging to the circuits that form the tunnel
* proto: Add comment emphasizing that the PollAll ordering matters.Gabriela Moldovan2025-09-251-0/+7
|
* proto: Add comment explaining why we need the chan_sender readiness check.Gabriela Moldovan2025-09-251-0/+3
|
* proto: Rewrite should_skip_join_point to return bool.Gabriela Moldovan2025-09-251-11/+10
| | | | | We don't really need to return a `HopNum` anymore (because we work out the join point `HopNum` unconditionally in `next_circ_action`).
* proto: Avoid polling join point streams more than once.Gabriela Moldovan2025-09-251-6/+11
| | | | | | If we poll the ready streams on the join point more than once per reactor loop, we risk sending more than one DATA cell (which is not good, because cc might block after the first cell is sent).
* proto: Remove now-unused function.Gabriela Moldovan2025-09-251-21/+2
|
* proto: Rewrite ConfluxSet::next_circ_action() using PollAll.Gabriela Moldovan2025-09-254-132/+109
| | | | | | | | | | | | | | | | | This removes our usage of `FuturesUnordered` in `ConfluxSet::next_circ_action()` to address two issues: * a fairness issue, where the futures driven by `FuturesUnordered` could be starved under some circumstances (#2180) * a logic error, where we'd explicitly avoid reading from the input channel if the outgoing `chan_sender` channel was blocked (#2179) Note that the fixing the latter will cause the reactor to buffer more into the unbounded `chan_sender` sink, but that *should* be okay, because no input message should be able cause us to queue cells excessively. Closes #2179, #2180
* proto: Expose CircHopList in ConfluxSet.Gabriela Moldovan2025-09-251-1/+1
| | | | | We will soon need to access this directly (rather than via a method on `Circuit`) to work around borrow checker limitations.
* proto: Return multiple actions from next_circ_action (fmt).Gabriela Moldovan2025-09-251-47/+47
|
* proto: Return multiple actions from next_circ_action.Gabriela Moldovan2025-09-252-4/+17
| | | | | | | Part of #2180 Note: the code is intentionaly left misindented to make reviewing a bit easier. A future commit will fix the indentation.
* proto: Push conflux state checks inside handshake_timeout() (fmt).Gabriela Moldovan2025-09-251-6/+6
|
* proto: Push conflux state checks inside handshake_timeout().Gabriela Moldovan2025-09-253-9/+13
| | | | | | This simplifies the calling code, which will, in turn, make it easier for us to simplify the logic in ConfluxSet::next_circ_action() and abolish the questionable use of FuturesUnordered.
* Merge branch 'expire-halfstream-cbt' into 'main'gabi-2502025-09-246-28/+233
|\ | | | | | | | | | | | | proto: Remove half-streams when they expire. Closes #264 See merge request tpo/core/arti!3267
| * proto: Temporarily ignore large_enum_variant clippy warning.Gabriela Moldovan2025-09-231-0/+1
| | | | | | | | I want to tackle this separately, as part of #2003
| * proto: Apply deferred rustfmt.Gabriela Moldovan2025-09-221-3/+1
| |
| * proto: Remove duplicate word in comment.Gabriela Moldovan2025-09-221-1/+1
| |
| * proto: Add new error type for cells received on non-existent streams.Gabriela Moldovan2025-09-223-11/+24
| | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3267#note_3261239
| * proto: Log circuit reactor errors at debug level.Gabriela Moldovan2025-09-221-2/+2
| |
| * proto: Reject any messages arriving on expired half-streams.Gabriela Moldovan2025-09-193-3/+11
| | | | | | | | | | | | Half-streams are periodically removed from each hop's stream map by the reactor main loop, but we still need to ensure we reject any messages arriving on expired half-streams in between these cleanup cycles.
| * proto: Add test to ensure half-streams are removed after a while.Gabriela Moldovan2025-09-191-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | This tests that the half-stream expiry works as expected. Note: it doesn't! This test currently fails, because there's a bug in the way half-streams are expired. Because we don't do it on a timer, and instead garbage-collect the half-streams on each reactor iteration, if the reactor is stuck long enough `.await`ing a message on one of its channels (for example, the `input` one), there is a chance it will accept a cell on a half-stream that should've been expired. A future commit will fix this bug.
| * proto: Calculate CBT more accurately.Gabriela Moldovan2025-09-192-4/+9
| | | | | | | | | | | | This should look at length of the circuit up until the hop where the half-stream is (because the half-stream might be on an intermediate hop, and not necessarily on the final one).
| * proto: Remove half-streams when they expire.Gabriela Moldovan2025-09-164-1/+33
| | | | | | | | Closes #264
| * proto: Use the CBT to compute half-stream timeouts.Gabriela Moldovan2025-09-163-9/+37
| |
| * proto: Give Each EndSentStreamEnt an expiry (fmt).Gabriela Moldovan2025-09-162-2/+8
| |
| * proto: Give Each EndSentStreamEnt an expiry.Gabriela Moldovan2025-09-164-8/+44
| |
| * proto: Remove unnecessary IEFE.Gabriela Moldovan2025-09-161-6/+4
| | | | | | | | | | The move of `self` into the closure was getting in the way, as I will need to reference `self` again below.
* | tor-proto: add some trace logs to XON/XOFF codeSteven Engler2025-09-221-0/+9
| |
* | Merge branch 'xon-xoff-checker' into 'main'David Goulet2025-09-187-42/+62
|\ \ | | | | | | | | | | | | tor-proto: Small improvements to XON/XOFF code See merge request tpo/core/arti!3273
| * | tor-proto: fix a hard-coded `cc_xoff_client`Steven Engler2025-09-182-4/+15
| | | | | | | | | | | | This should be `cc_xoff_exit` if we're an exit.
| * | tor-proto: rename `take_capacity_to_send` to `about_to_send`Steven Engler2025-09-186-27/+21
| | | | | | | | | | | | | | | | | | XON/XOFF flow control doesn't have the idea of taking "capacity". But it does need to know the messages we're about to send so that it can count the number of stream bytes that we've sent.
| * | tor-proto: add checks for receiving XON/XOFF before data sentSteven Engler2025-09-171-0/+14
| | |
| * | tor-proto: share the `FlowCtrlParameters` across streamsSteven Engler2025-09-173-11/+12
| | | | | | | | | | | | | | | Streams at the same circuit hop will now share a single `Arc<FlowCtrlParameters>`.
* | | Merge branch 'simple_circpad_todos' into 'main'gabi-2502025-09-183-32/+45
|\ \ \ | |/ / |/| | | | | | | | Resolve blocking padding-related TODOs See merge request tpo/core/arti!3271
| * | proto: Use a VecDeque for padding events; avoid reversing.Nick Mathewson2025-09-171-11/+7
| | |
| * | proto: Rename PaddingEventVec => PaddingEventQueueNick Mathewson2025-09-171-5/+5
| | |
| * | proto: Fix a pair of padding setup TODOs.Nick Mathewson2025-09-171-22/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we install a new padder, we should check whether we have become unblocked, and we should wake up the PaddingEventStream in case the new padder has something to say. This has required us to move a couple of fields around, but not in a very complicated way.
| * | proto: resolve/edit trivial "TODO circpad" instances.Nick Mathewson2025-09-173-6/+8
| | |
* | | Merge branch 'xon-xoff-checker-2' into 'main'opara2025-09-186-42/+353
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | tor-proto: Add dropmark sidechannel mitigations for XON/XOFF flow control Closes #2129 See merge request tpo/core/arti!3266
| * | | tor-proto: improved the `SidechannelMitigation` testsSteven Engler2025-09-171-67/+67
| | | |
| * | | tor-proto: enabled some tests for `SidechannelMitigation`Steven Engler2025-09-171-12/+9
| | | |
| * | | tor-proto: update some comments for `SidechannelMitigation`Steven Engler2025-09-171-3/+41
| | | |
| * | | tor-proto: add some tests for XON/XOFF `SidechannelMitigation`Steven Engler2025-09-161-0/+81
| | | |
| * | | tor-proto: rename `FlowCtrlMethods` to `FlowCtrlHooks`Steven Engler2025-09-165-10/+8
| | | |