aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/congestion
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: change some instances of `sendme_inc` to u8Steven Engler2026-08-121-6/+4
|
* tor-proto: fix cc vegas counter updates on clock stallSteven Engler2026-07-301-6/+7
| | | | | | | | | | | | | | | | | | The pseudocode says: ```text if next_cc_event: next_cc_event-- if next_cwnd_event: next_cwnd_event-- if clock_stalled_or_jumped: inflight -= 'cc_sendme_inc' return ``` but we were previously decrementing these after the return rather than before.
* hsclient: Support protocol negotiation for CGO and flowctrl-ccNick Mathewson2026-07-021-0/+6
|
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-093-0/+3
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-proto: vegas: return early if clock stall was detectedSteven Engler2026-05-072-5/+15
|
* tor-proto: rtt: return clock stall/jump status from `update()`Steven Engler2026-05-071-4/+13
|
* proto: Add a test helper function for building a CircNetParametersDavid Goulet2026-04-141-0/+55
| | | | | | | | | We can't access `NetParameters` in this crate to build from consensus default value so instead add a `defaults_for_tests()` gated function for each parameters object which puts in the defaults from the spec. We'll need CircNetParameters in order to build create request handler for unit tests hence why it is in src/circuit.rs.
* tor-proto: derive `strum::EnumDiscriminants` for `Algorithm`Steven Engler2026-04-081-1/+4
|
* tor-proto: Port to web-time-compatNick Mathewson2026-03-262-8/+6
|
* proto: Remove unnecessary test-gatingGabriela Moldovan2026-03-191-4/+0
| | | | | The `test_util` modules is already gated behind `#[cfg(any(test, feature = "testing"))]`.
* proto: Use is_multiple_of() as suggested by clippyGabriela Moldovan2026-02-162-2/+2
|
* proto: Make CongestionWindow CopyGabriela Moldovan2025-11-172-4/+4
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-063-3/+3
| | | | Run maint/add_warning
* proto: Add an accessor for the max observed circ RTT.Gabriela Moldovan2025-09-161-0/+6
| | | | We will need this to calculate the END ack timeout.
* proto: Pass owned CongestionWindowParams to CongestionControl::new.Gabriela Moldovan2025-09-042-1/+2
| | | | | | | We no longer need to clone `CongestionWindowParams` now that it implements `Copy`. Resolves a clippy warning.
* proto: Derive Copy for CongestionWindowParams.Gabriela Moldovan2025-09-041-1/+1
| | | | | These will likely always just be a collection of integers (lightweight to copy).
* clippy: fix `clippy::duplicated_attributes` warningsSteven Engler2025-08-112-2/+0
| | | | | | | | | | ```text warning: duplicated attribute --> crates/tor-hsservice/src/timeout_track.rs:630:14 | 630 | #![allow(clippy::needless_pass_by_value)] // TODO hoist into standard lint block | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-075-5/+5
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Rename and invert the sense of requires_stream_level_sendmes.Nick Mathewson2025-07-231-4/+8
| | | | | 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-231-0/+11
| | | | Let's see if it works!
* tor-proto: add `CongestionControl::uses_xon_xoff()`Steven Engler2025-07-162-0/+9
|
* proto: Make RttEstimator::{ewma,min}_rtt_usec() return `Option`.Gabriela Moldovan2025-06-272-12/+12
| | | | | | | | | | A `None` value signals to the conflux code to know to fall back on the initial RTT of the circuit. Without this change, the conflux switching logic is broken as we end up staying on the leg with the best initial RTT forever (the other leg is never picked, because its `ewma_rtt()` is stuck on `u32::MAX`, and never updated as we never send on it).
* 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.
* proto: Make RTT estimates default to None (fmt).Gabriela Moldovan2025-06-251-2/+6
|
* proto: Make RTT estimates default to None.Gabriela Moldovan2025-06-251-31/+48
| | | | | | | | | | The `RttEstimator` now uses `None` to represent not-yet-measured RTTs. Previously, all the measured RTTs defaulted to 0, in contradiction with the `RttEstimator::{min,ewma}_rtt_usec()` docs, which state that both functions are supposed to return `u32::MAX` if there is no estimate. Closes #2049
* tor-proto: Add an accessor for the cc algorithm.Gabriela Moldovan2025-06-112-3/+17
| | | | | | Conflux is only supported when prop324 congestion control is enabled, so we need an accessor for the cc algorithm of a given circuit hop in order for the conflux code to be able to check *which* cc algorithm is in use.
* tor-proto: Remove no-longer needed clone()s.Gabriela Moldovan2025-06-113-6/+6
| | | | | | This doesn't really change anything, but removing the `.clone()` makes it a bit more obvious that copying the `*Params` is a lightweight operation.
* tor-proto: Derive Copy for FixedWindowParams.Gabriela Moldovan2025-06-111-1/+1
|
* tor-proto: Derive Copy for VegasParams.Gabriela Moldovan2025-06-111-2/+2
|
* proto: Refactor cc fallback.Nick Mathewson2025-06-102-6/+6
| | | | | The fallback CC algorithm is _always_ fixed-window, and we should only use it when the selected CC algorithm is not supported.
* Move responsibility for choosing extensions into tor-protoNick Mathewson2025-06-101-1/+1
| | | | | | | | | Now tor-circmgr no longer needs to check which Protover capabilities are enabled, or construct a separate CircParameters for each hop. Instead, tor-proto decides whether to use the fallback CC mode, based on whether the target supports FLOWCTRL_CC. Closes #1967.
* proto: Split CircParameters and NegotiatedHopSettingsNick Mathewson2025-06-101-8/+5
| | | | | | | | | | | One type will now represent _the kind of hop we are asking tor-proto to negotiate_; the other will represent _the state of such negotiation_. This doesn't simplify the code much yet, but it will be helpful as we add more and more negotiable settings. Part of #1967
* Remove the last traces of CircTag.Nick Mathewson2025-05-061-3/+0
|
* proto: Use SendmeTag in place of CircTagNick Mathewson2025-05-061-38/+2
| | | | | This doesn't make much change yet, but does save us an allocation when handling SENDMEs.
* tor-proto: Add congestion control accessors for conflux.Gabriela Moldovan2025-05-062-0/+10
|
* tor-proto: expand docs for `CongestionWindowParams::set_sendme_inc`Steven Engler2025-04-231-1/+5
|
* tor-proto: rename `allow_stream_sendme` to `uses_stream_sendme`Steven Engler2025-04-232-2/+2
| | | | | We use this method to decide whether to allow receiving stream SENDMEs, and also whether we should send stream SENDMEs.
* tests: Add CC ntorv3 negotiation unit testDavid Goulet2025-04-232-5/+52
| | | | | | | | Also add one for the sendme_inc validity function. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* circ: Don't send stream level SENDME with CCDavid Goulet2025-04-232-0/+8
| | | | | | | | | | | | | This adds a new function to the CongestionControl object that returns true or false on if stream level SENDMEs are allowed by the underlying algorithm. Congestion control Vegas doesn't allow them as in it retires them and so we avoid sending them for that algorithm. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* circ: Apply possible subprotocol changes to circ paramsDavid Goulet2025-04-231-1/+5
| | | | | | | | | | | | | Congestion control can change the circuit parameters if the relay we are negotiating with doesn't support FlowCtrl=2. This commit adds a function in the circuit builder that will apply any changes to the circuit parameters of the hop based on the hop protocol values. For now, only congestion control applies. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* congestion: Setup a fallback algorithm in the paramsDavid Goulet2025-04-232-1/+9
| | | | | | | | | | | | | | | | CircParameters is built before path selection and thus once we start building the hops, we can't access the consensus values that were used to build it in the first place. For congestion control, we require a fallback algorithm in case the hop doesn't support FlowCtrl=2. This commit adds a "fallback_alg" to the CC parameters which will be used for this exact case. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* circ: Set the negotiated CC sendme_inc from handshakeDavid Goulet2025-04-231-0/+38
| | | | | | | | | | | When receiving the congestion control response extension, evaluate our state and set the sendme_inc if valid in our circuit parameters. For this, a series of helper functions is needed. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* Add a RelayCellFormat argument to encode().Nick Mathewson2025-04-161-2/+3
| | | | | | | | | This will let us actually _send_ messages in the right format. This approach is not ideal for packed/fragmented messages; they will need a separate RelayCellEncoder. part of #1944.
* fix: fix typosDimitris Apostolou2025-01-303-7/+7
|
* tor-proto: Use SENDME_TAG_LEN constant instead of magic value.Gabriela Moldovan2025-01-281-6/+7
|
* tor-proto: Use CircTag::try_from for clarity.Gabriela Moldovan2025-01-281-0/+10
|
* tor-proto: Use CircTag instead of raw byte slice.Gabriela Moldovan2025-01-281-1/+1
|
* congestion: Use getters for all parametersDavid Goulet2025-01-163-49/+72
| | | | | | Allows us to remove the pub. Signed-off-by: David Goulet <[email protected]>
* congestion: Remove Default from every parametersDavid Goulet2025-01-162-24/+6
| | | | | | | Important to enforce that every field is explicitely set so we avoid forgetting fields. Signed-off-by: David Goulet <[email protected]>
* congestion: Make the cc_alg values a caret_int for better code semanticDavid Goulet2025-01-161-0/+14
| | | | Signed-off-by: David Goulet <[email protected]>