summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
* proto: Add test for ShutdownAndReturnCircuit error condition.Gabriela Moldovan2025-07-251-0/+47
| | | | | | | This command is supposed to return an error when handled by a tunnel reactor that has more than one circuit. Prevents the `ConfluxSet::take_single_leg()` bug fixed in 00bb0628.
* proto: Remove an already-addressed TODO.Gabriela Moldovan2025-07-251-2/+0
| | | | This was fixed in !3091
* proto: Remove element_idx + remove in favor of remove_unchecked().Gabriela Moldovan2025-07-251-11/+1
|
* proto: Replace hand-rolled exactly_one() impl with itertools.Gabriela Moldovan2025-07-252-52/+27
| | | | | | | This slightly reduces the amount of code we need to maintain. This also drive-by fixes a bug in `ConfluxSet::take_single_leg`, which previously never actually checked if the conflux set was of size one.
* proto: Add a ConfluxSet::remove_unchecked method.Gabriela Moldovan2025-07-251-0/+16
| | | | | This method will enable us to remove some duplicated code, as well as the `element_idx` function.
* tor-proto: Temporary measure to disable CGO.Nick Mathewson2025-07-231-1/+11
| | | | | | | | | | | | | This commit prevents us from ever deciding that another relay supports CGO, which prevents us from trying to negotiate it. It also adds an assertion to make sure that we haven't tried to negotiate it. We can remove this once we're ready to have CGO turned on: right now it's blocked on being able to negotiate CC. I'm adding this so we can merge this branch (so that I can stop rebasing it.)
* Downgrade an XXXX to a TODO.Nick Mathewson2025-07-231-1/+3
|
* Remove now-needless allow(unused).Nick Mathewson2025-07-231-1/+0
|
* Refactor/simplify HopSettings constructionNick Mathewson2025-07-232-60/+108
| | | | | | | We now take an enum describing whether we are doing no negotiation, HsV3 negotiation, or full negotiation. This lets us do away with the notions of default relay crypto, and of declaring post-facto that no negotiation has occurred.
* Rename and invert the sense of requires_stream_level_sendmes.Nick Mathewson2025-07-232-5/+9
| | | | | Instead call it compatible_with_cgo, which is what we actually care about in this context.
* proto: Send extensions as appropriate to negotiate CGO.Nick Mathewson2025-07-233-1/+54
| | | | Let's see if it works!
* proto: Construct CGO instances if that is what is selected.Nick Mathewson2025-07-232-2/+15
|
* proto: Take format+crypto settings from HopSettingsNick Mathewson2025-07-237-54/+58
| | | | | Since these will be negotiated (or determined as part of negotiation) they belong in HopSettings.
* tor-basic-utils: add `assert_val_impl_trait!` macroSteven Engler2025-07-171-2/+5
|
* tor-proto: replace `DataReader`Steven Engler2025-07-172-44/+48
| | | | | | | | | | | | `DataReader` -> `DataReaderInner` `DataReaderNew` -> `DataReader` This means that the `DataReader` now supports XON/XOFF flow control using the `XonXoffReader`. This means that it can receive requests for a new drain rate from the reactor, and can send the new drain rate to the reactor once there is no more stream data queued.
* tor-proto: add `DataReaderNew`Steven Engler2025-07-173-5/+75
| | | | This will later become `DataReader`.
* tor-proto: add `StreamReceiver::is_empty()`Steven Engler2025-07-171-1/+39
|
* tor-proto: add the `XonXoffReader` and connect it to the reactorSteven Engler2025-07-1711-15/+267
| | | | | | | | | | | | The idea here is that the reactor builds an `XonXoffReaderCtrl` for the new stream, and the `XonXoffReaderCtrl` can receive notifications from the reactor's `StreamFlowControl`. The `XonXoffReaderCtrl` can be combined with any `AsyncRead` to build a `XonXoffReader`, essentially wrapping the `AsyncRead` with a type that handles XON/XOFF flow control. Essentially, the reactor gives you a type that allows you to add XON/XOFF flow control support to any `AsyncRead`. We will add this `XonXoffReader` to the `DataReader` in a future commit.
* tor-proto: add plumbing for sending XONSteven Engler2025-07-176-5/+171
| | | | | Nothing actually causes an XON to be sent yet. But this adds the code so that anything holding the `StreamTarget` can request to send an XON.
* tor-proto: move some code into a `approx_stream_bytes_buffered()` fnSteven Engler2025-07-171-6/+11
|
* Merge branch 'flow-ctrl' into 'main'opara2025-07-1617-160/+591
|\ | | | | | | | | tor-proto,tor-cell: Code refactoring and add support for sending XOFF messages See merge request tpo/core/arti!3094
| * tor-cell: add `FlowCtrlVersion::V0`Steven Engler2025-07-161-12/+2
| |
| * tor-proto: send XOFF messages when the queue grows too largeSteven Engler2025-07-166-6/+121
| |
| * tor-proto: add `CongestionControl::uses_xon_xoff()`Steven Engler2025-07-163-0/+19
| |
| * tor-proto: add dedicated types for the incoming stream queueSteven Engler2025-07-1610-24/+275
| | | | | | | | | | XON/XOFF flow control will want to know how many data bytes are queued on a stream, so the new types track that.
| * tor-proto: combine some objects into a `StreamComponents`Steven Engler2025-07-152-28/+64
| | | | | | | | | | | | As we continue adding more functionality to streams like flow control, we'll have more objects to pass around. This tries to group them together.
| * tor-proto: rename `StreamSendFlowControl` and related changesSteven Engler2025-07-155-46/+47
| | | | | | | | | | | | | | | | The plan is to use `StreamSendFlowControl` (now `StreamFlowControl`) for both outgoing and incoming directions, so a name change is needed. This also updates some comments, and renames some related struct fields that have the word "send" in them.
| * tor-proto: adjust `CtrlMsg::SendSendme` and renameSteven Engler2025-07-153-60/+80
| | | | | | | | | | | | | | | | This allows us to extend the command to implement different flow control methods. We could add new command variants for new flow control methods instead, but I think it makes sense to have them be a single command as they will always have a stream ID / hop location in common. This also helps us keep the flow control logic in one place.
| * tor-cell: remove `flowctl-cc` feature and make XON/XOFF cells stableSteven Engler2025-07-151-1/+0
| | | | | | | | | | I don't see any further changes being needed for these types, and it simplifies a lot of future code in tor-proto that uses these types.
* | proto: Add some docs for the conflux stream tests.Gabriela Moldovan2025-07-161-0/+27
| |
* | proto: Explain why the test MockRuntime is behind a mutex.Gabriela Moldovan2025-07-161-1/+6
| |
* | conflux: Ensure the min-heap is really a min-heap.Gabriela Moldovan2025-07-161-1/+1
| | | | | | | | | | | | | | | | The `Ord` impl of `OooRelayMsg` already "reverses" the seqno comparison, which means previously we were double-reversing it (leading to the ooo cell heap logic being broken in cases where its size was > 1). Caught by the new conflux switch handling tests.
* | conflux: Add test for out-of-order cell handling in the client.Gabriela Moldovan2025-07-161-3/+252
| |
* | proto: Make the mock exit start writing to the stream.Gabriela Moldovan2025-07-161-1/+84
| |
* | proto: Replace oneshot completion channel with event channel.Gabriela Moldovan2025-07-161-18/+45
| | | | | | | | | | | | | | The two mock exit legs will use this channel to notify each other of the receipt of BEGIN cells. This will enable us to extend the tests to support writing cells to the stream (but only after the stream is opened).
* | proto: Give ConfluxStreamState a constructor.Gabriela Moldovan2025-07-161-7/+14
| |
* | proto: Replace tuple with struct with named fields for clarity.Gabriela Moldovan2025-07-161-37/+30
| | | | | | | | This abolishes the overly-long tuple used in these tests.
* | proto: Move list of expected switches to a separate variable.Gabriela Moldovan2025-07-161-26/+30
| | | | | | | | | | I am moving these out of the `relays` list, in preparation for a minor refactoring around that part.
* | proto: Clarify docs to say who the receiver of the data_recvd is.Gabriela Moldovan2025-07-161-1/+1
| |
* | proto: Remove no-longer accurate comment from test.Gabriela Moldovan2025-07-161-4/+0
| |
* | proto: Refactor test loop exit condition.Gabriela Moldovan2025-07-161-1/+13
| | | | | | | | | | This is about to become slightly more complex, as the mock exit will support writing to the stream too.
* | proto: Rename test for clarity.Gabriela Moldovan2025-07-161-1/+1
|/ | | | | I will another test for exit-to-client transmissions, so I am preemptively renaming its counterpart.
* Merge branch 'flow-ctrl' into 'main'opara2025-07-1012-96/+327
|\ | | | | | | | | tor-proto: Handle incoming XON/XOFF messages See merge request tpo/core/arti!3054
| * tor-proto: renamed `get_bytes_per_sec()` to `bytes_per_sec()`Steven Engler2025-07-102-2/+2
| |
| * tor-proto: changed 'if' statements to 'match'Steven Engler2025-07-102-22/+34
| |
| * tor-proto: added TODOs for making rate limit stream optionalSteven Engler2025-07-092-0/+2
| |
| * tor-proto: set `XonXoffBased` variant behind "flowctl-cc" featSteven Engler2025-07-072-5/+23
| |
| * tor-proto: finish support for `StreamSendFlowControl` XON/XOFFSteven Engler2025-07-071-7/+4
| |
| * tor-proto: handle XON/XOFF messagesSteven Engler2025-07-075-7/+101
| |
| * tor-proto: establish channel for rate limit updatesSteven Engler2025-07-079-31/+127
| |