summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | proto: Run test handshake outside of exit task.Gabriela Moldovan2025-06-271-10/+17
| | | |
* | | | proto: Avoid switching legs unnecssarily.Gabriela Moldovan2025-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | If we're already on the best leg, we don't need to switch (even if the other leg happens to have the same "best" RTT).
* | | | proto: Ensure we get all the expected SWITCH cells.Gabriela Moldovan2025-06-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this failed to assert that the mock relays received all the expected SWITCH cells. As it turns out, the assertion currently fails, because the default value for our estimated RTTs is no longer zero (as of !3074), so we no longer unnecessarily switch legs as much as we used to.
* | | | proto: Sort the received test data.Gabriela Moldovan2025-06-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conflux client now sends data to the mock exit relay over both legs (it SWITCHes legs at some point), which causes the test to fail (because the two legs of the mock exit write the data racily to the same `Vec`, without attempting to put it in the right order). To work around the lack of handling of out-of-order cells at the mock exit, we can just sort the received data to make sure we got it all.
* | | | proto: Add trace log for conflux leg switch events.Gabriela Moldovan2025-06-271-1/+7
| | | |
* | | | proto: Fix conflux-related congestion control proto violation.Gabriela Moldovan2025-06-271-1/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if the primary leg was blocked on cc, the conflux set would continue polling the stream map non-blocked leg, and send a `CircuitCmd::Send` instructing the reactor to send a DATA cell on the non-blocked leg. The reactor would then (wrongly) reroute the DATA cell to the primary leg, in violation of congestion control.
* | | | proto: Support inserting varied RTT delays in test (fmt).Gabriela Moldovan2025-06-271-16/+3
| | | |
* | | | proto: Support inserting varied RTT delays in test.Gabriela Moldovan2025-06-271-21/+25
| | | | | | | | | | | | | | | | | | | | This will enable us to trigger conflux leg switches at various points in the transmission.
* | | | proto: s/circ_sink/circ_tx for consistency.Gabriela Moldovan2025-06-271-15/+15
| | | | | | | | | | | | | | | | For consistency with `chan_tx`.
* | | | proto: Pass TestCircuitCtx to mock exit task (fmt).Gabriela Moldovan2025-06-271-3/+15
| | | |
* | | | proto: Pass TestCircuitCtx to mock exit task.Gabriela Moldovan2025-06-271-33/+20
| | | | | | | | | | | | | | | | | | | | As opposed to passing the individual parts of `TestCircuitCtx` (I find this slightly neater).
* | | | proto: Apply deferred cargo fmtGabriela Moldovan2025-06-271-2/+11
| | | | | | | | | | | | | | | | This is a mess. A future commit will make it slightly less horrible.
* | | | proto: Unbreak the conflux stream test.Gabriela Moldovan2025-06-271-3/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a problem which caused the test to stall waiting for a cell (simply blocking on receiving a cell is wrong, because it's possible for the other leg to have already completed the transfer; we need to be able to bail upon receiving a completion notification from the other leg).
* | | | proto: Put mock runtime behind mutex.Gabriela Moldovan2025-06-271-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mutex prevents concurrent uses of `MockRuntime::advance_until_stalled` (which are forbidden by the mock runtime), enabling us to call this (and its functions that advance time) more liberally in the future. Note: the `multipath_stream` test is *still* broken, but slightly less so. Now the only failure is "all futures blocked. waiting for the real world? or deadlocked (waiting for each other) ?", which can be solved by ensuring the mock exit tasks always exit: now that the mock client task keeps the stream alive until it receives an END cell, we need to ensure the exits tasks can complete their own, without relying on the client to end the stream. This will be fixed in another commit.
* | | | proto: Send an END at the end of the test conflux stream (fmt).Gabriela Moldovan2025-06-271-1/+3
| | | |
* | | | proto: Send an END at the end of the test conflux stream.Gabriela Moldovan2025-06-271-7/+31
| | | | | | | | | | | | | | | | | | | | This enables the new `read_until_end()` call in the mock client task to complete (otherwise it will just hang, waiting for the stream to end).
* | | | proto: Make conflux mock exit send SENDMEs at the right time.Gabriela Moldovan2025-06-271-16/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now send the SENDMEs as per the client's expectations, using the right tags. This makes the test less fragile and easier to extend. Note: the `multipath_stream` test currently fails, because the mock exit endpoint never actually sends an END, so the stream never gets closed: ``` all futures blocked. waiting for the real world? or deadlocked (waiting for each other) ? ``` This will be fixed in a future commit.
* | | | proto: Support QuerySendWindow for multipath tunnels (fmt).Gabriela Moldovan2025-06-271-7/+3
| | | |
* | | | proto: Support QuerySendWindow for multipath tunnels.Gabriela Moldovan2025-06-272-5/+8
| | | | | | | | | | | | | | | | | | | | We're about to use this in a conflux test, to get the mock exit to reliably send valid SENDMEs to the client.
* | | | proto: Support receiving data in the test client.Gabriela Moldovan2025-06-271-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, the `multipath_stream` conflux test fails, because the mock exit endpoint never actually closes the stream. This problem will be solved in a future commit.
* | | | proto: s/stream_data/send_data for clarity.Gabriela Moldovan2025-06-271-10/+10
| | | | | | | | | | | | | | | | I'm about to add a `recv_data` too.
* | | | proto: Use UniqId instead of leg index in tests (fmt).Gabriela Moldovan2025-06-271-3/+1
| | | |
* | | | proto: Use UniqId instead of leg index in tests.Gabriela Moldovan2025-06-271-3/+8
| | | | | | | | | | | | | | | | | | | | This is currently only used for logging purposes, but we will soon need the actual `UniqId` of the test circuit leg to query its CC state.
* | | | proto: Replace magic numbers with constants in test (fmt).Gabriela Moldovan2025-06-271-1/+4
| | | |
* | | | proto: Replace magic numbers with constants in test.Gabriela Moldovan2025-06-271-1/+6
| | | | | | | | | | | | | | | | For clarity, and so we don't forget what these numbers mean.
* | | | proto: Add docs to various conflux test structures.Gabriela Moldovan2025-06-271-0/+19
|/ / / | | | | | | | | | | | | I am about to add more fields to these, so I'm documenting the existing ones so we don't get confused about what they represent.
* | | tor-proto: Renamed `DataReaderState::Ready` to `Open`Steven Engler2025-06-261-9/+12
| | |
* | | tor-proto: improve documentation for `StreamTarget::send_sendme`Steven Engler2025-06-261-1/+7
| | |
* | | tor-proto: log warning for SENDME reactor errorSteven Engler2025-06-261-5/+10
| | |
* | | tor-proto: remove unneeded `DataReaderState::ReadingCell` stateSteven Engler2025-06-261-10/+6
| | | | | | | | | | | | | | | Now that we no longer need to store a future, there's no need for this state since we're never pending waiting for a future to complete.
* | | tor-proto: rework `StreamReceiver` into a `futures::Stream`Steven Engler2025-06-264-75/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having this be a `futures::Stream` makes it nicer to work with. For example we are able to remove a boxed future from `DataReaderState`, which should be better for performance and makes the code simpler. As mentioned in a previous commit when this type was named `StreamReader`, this type is public in the API, but is not actually accessible. As far as I can tell there is no way to construct it or access it.
* | | Make `StreamTarget::send_sendme` non-asyncSteven Engler2025-06-263-33/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are some pros/cons to this change: Pros: 1. The only remaining `await` in `StreamReceiver::recv` is for polling the receiver, which means we can turn the `StreamReceiver` into a `Stream` in a future commit. 2. We won't block the user from receiving messages while we wait for the circuit reactor to receive our SENDME message and send it on the outgoing channel. 3. The `StreamReceiver` doesn't really care if it can't send the SENDME. There isn't anything it can do, the circuit hop can go away for external reasons like a DESTROY message, and we still want to return all queued messages to the user anyways. Cons: 1. If the `StreamReceiver` sends a SENDME request to the circuit reactor, and the circuit reactor fails to send the SENDME, there's no good way for the reactor to communicate this back to the `StreamReceiver`.
* | | tor-proto: rename `StreamReader` to `StreamReceiver`Steven Engler2025-06-267-36/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In rust, the typical nomenclature is to use "receiver" for channels, and "reader" for byte streams. For example `mpsc::Receiver` for something that returns objects and `AsyncRead` for something that reads bytes. Since we also have a `DataReader` for reading bytes, I think renaming this from `StreamReader` to `StreamReceiver` better describes what it is (it's not a "reader" in the typical `Read`/`AsyncRead` sense). This type is public in the API, but is not actually accessible. As far as I can tell there is no way to construct it or access it.
* | | Merge branch 'ticket_2006' into 'main'Alexander Hansen Færøy2025-06-262-6/+8
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Improve descriptions of rejected relays: omit "rejected 0/X" Closes #2006 See merge request tpo/core/arti!3072
| * | | Improve descriptions of rejected relays: omit "rejected 0/X"Nick Mathewson2025-06-252-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now instead of saying "rejected 0/40 as not usable as middle relay; 28/40 as in same family as already selected", we say "rejected 28/40 as in same family as already selected". Closes #2006.
* | | | proto: Remove unused function from ConfluxSetDavid Goulet2025-06-261-5/+0
| | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | | | hsservice: Stop using HopNum and use TargetHopDavid Goulet2025-06-266-28/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires some changes to the tor-proto crate to handle the inbound TargetHop from the HS subsystem and then resolve it into a HopNum for a single circuit. It is expected that this will change again with Conflux to only use HopLocation internally in a Tunnel and then use HopNum into a Circuit. Signed-off-by: David Goulet <[email protected]>
* | | | proto: Make send_raw_msg() use a TargetHopDavid Goulet2025-06-263-16/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for this to work, a last_target_hop() function is added to ClientCirc in order to return a precise hop location as a TargetHop of the last hop. This is needed because in the HS subsystem, we need such value in order to get a location on the last physical hop before adding the virtual hop. The RDV1 cell is sent to that last target hop while the allow_stream_request() is done on the virtual target hop. Signed-off-by: David Goulet <[email protected]>
* | | | hs: Remove the use of HopNum and instead use TargetHopDavid Goulet2025-06-269-18/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is in the spirit of making everything going inbound the tor-proto crate to use a TargetHop. This becomes much easier for the HS subsystem as it only uses the last hop for its conversation and setup. Signed-off-by: David Goulet <[email protected]>
* | | | proto: Add From<(UniqId, HopNum)> for TargetHopDavid Goulet2025-06-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quick helper as within the tor-proto crate, we sometimes have to quickly get a TargetHop. This will come handy with the message handler used by the Conversation object that the HS subsystem uses. Signed-off-by: David Goulet <[email protected]>
* | | | proto: Add a control command to get the binding keyDavid Goulet2025-06-263-16/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to use TargetHop instead of HopNum but also to get one step closer to not depend on a mutable state. We prefer resolving a TargetHop within the Reactor object in order to use the circuit list instead of the MutableState path. The HS service subsystem is modified to use this modified function that is now async and uses a TargetHop. Signed-off-by: David Goulet <[email protected]>
* | | | proto: Make TargetHop and HopLocation publicDavid Goulet2025-06-262-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is about to be used outside of tor-proto. It is part of the work to remove the use of HopNum outside tor-proto. The rules are: - Inbound requsest to the tor-proto crate, TargetHop must always be used. - Within tor-proto, TargetHop is resolved into a HopLocation which is more precise and based on the tunnel circuit(s). This is another piece that Conflux will require considering that a Tunnel might have multiple circuits in the future. Signed-off-by: David Goulet <[email protected]>
* | | | proto: Add helper function to resolve TargetHopDavid Goulet2025-06-261-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Reactor has two functions to resolve both TargetHop into a HopLocation and then a HopLocation into a (UniqId, HopNum). This commit simply adds a helper that does both but returns an Option instead of a Result as it will be used by the reactor command handler and more in future conflux commits. Signed-off-by: David Goulet <[email protected]>
* | | | Merge branch 'notify' into 'main'opara2025-06-253-0/+187
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | tor-proto: Add `Notify{Sender,Receiver}` channel See merge request tpo/core/arti!3066
| * | | | tor-proto: add `Notify{Sender,Receiver}` channelSteven Engler2025-06-233-0/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An async notification channel. This uses `postage::watch::{Sender,Receiver}` internally.
* | | | | Merge branch 'mockable-time' into 'main'David Goulet2025-06-253-7/+20
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | tor-proto: Give Circuit a handle to the DynTimeProvider. See merge request tpo/core/arti!3063
| * | | | | tor-proto: Use mockable runtime in congestion control RTT estimator (fmt).Gabriela Moldovan2025-06-231-1/+2
| | | | | |
| * | | | | tor-proto: Use mockable runtime in congestion control RTT estimator.Gabriela Moldovan2025-06-232-7/+13
| | | | | |
| * | | | | tor-proto: Give Circuit a handle to the DynTimeProvider.Gabriela Moldovan2025-06-232-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will enable us to replace the calls to `Instant::now()` with `DynTimeProvider::now()` throughout the RTT estimator. This gives us the ability to mock the time, and test that conflux leg switching occurs as expected.
* | | | | | proto: Rewrite can_crosscheck_with_current_estimate for clarity.Gabriela Moldovan2025-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The expanded expression makes it easier to see that `can_crosscheck_with_current_estimate()` can never return `true` if `self.ewma_rtt` is `None`, and that the `expect()` from `is_clock_stalled()` cannot panic.