summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/util
Commit message (Collapse)AuthorAgeFilesLines
* padding: Remove post-queue blocker.Nick Mathewson2025-09-301-1/+5
| | | | | | | We no longer want to _ever_ block non-DATA cells, per discussion in circuit-padding.md. Closes #2190.
* proto: Document exactly how PollAll polls its futures.Gabriela Moldovan2025-09-251-1/+11
|
* proto: Resolve a couple of clippy warnings in the tests.Gabriela Moldovan2025-09-251-2/+2
|
* proto: Add PollAll helper for driving futures in lockstep.Gabriela Moldovan2025-09-251-0/+195
|
* Merge branch 'expire-halfstream-cbt' into 'main'gabi-2502025-09-241-0/+17
|\ | | | | | | | | | | | | proto: Remove half-streams when they expire. Closes #264 See merge request tpo/core/arti!3267
| * proto: Add new error type for cells received on non-existent streams.Gabriela Moldovan2025-09-221-0/+17
| | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3267#note_3261239
* | Merge branch 'migrate-to-waker-noop' into 'main'Jim Newsome2025-09-221-6/+4
|\ \ | | | | | | | | | | | | Migrate to waker noop See merge request tpo/core/arti!3250
| * | Migrate to waker noopdisha2025-09-221-6/+4
| | |
* | | counting_policy: fix a doc link.Nick Mathewson2025-09-171-1/+1
| | |
* | | proto::util::sink_blocker: Narrow dead_code warning exception.Nick Mathewson2025-09-172-17/+6
| |/ |/|
* | Merge branch 'maybenot-validate-padding' into 'main'Nick Mathewson2025-09-151-1/+20
|\ \ | | | | | | | | | | | | Validate incoming padding, and permit it when it is valid. See merge request tpo/core/arti!3241
| * | proto: Use a new error type for excess padding.Nick Mathewson2025-09-151-1/+20
| |/
* / proto: Only replace padding when the target will see it.Nick Mathewson2025-09-101-0/+8
|/ | | | | | | | | | | Previously we would replace padding with any cell that was already in the queue. But that doesn't make sense: If we have a cell queued for hop 1, then we shouldn't use it as padding for hop 2, since hop 2 will never see it! Instead, we look at the target hops for the already queued cells. Ref: - https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3225/diffs?commit_id=3998e0559fbcc06f8ea88968051cebca71489a52
* Two grammar/typo fixes from @gabi-250Nick Mathewson2025-09-091-1/+1
|
* proto: add SometimesUnboundedSink::as_inner_mut.Nick Mathewson2025-09-091-0/+11
| | | | Include suitable dire warnings about actually using it.
* SinkBlocker: Add a comment in poll_flushNick Mathewson2025-09-081-0/+2
|
* SometimesUnboundedSink: clarifying documentation.Nick Mathewson2025-09-081-0/+7
| | | | | Explain how exactly its "you-must-poll-me" behavior relates to the rest of the Sink ecosystem.
* proto: Make CountingPolicy constructors pub(crate).Nick Mathewson2025-09-081-3/+3
|
* proto: Define a new composable SinkBlocker type.Nick Mathewson2025-09-043-0/+540
| | | | | | | | This type wraps a futures::Sink, and allows it to be temporarily blocked and unblocked. I'm going to use this to implement padding-based circuit blocking, according to the designs in !3225.
* proto: Make the OutboundClientHandshake use new cell handlerDavid Goulet2025-08-201-9/+0
| | | | | | | | | | | | | | | | | Use the ChannelFrame<> for the entirety of the outbound client handshake that is the ClientInitiator channel type. With this change, the codec.rs code is not needed anymore along its CodecError as well which has been normalized onto the crate::Error instead in order to simplify error handling and avoid duplication of error types. Unit tests have been modified to reflect this change of what can be done with a channel frame. Also renamed to focus on client behavior. Part of #1597 Signed-off-by: David Goulet <[email protected]>
* proto: Implement a From<std::io::Error> for ErrorDavid Goulet2025-08-201-0/+6
| | | | | | | | | To be able to return a crate::Error from the Decoded/Encoder trait, it needs to implement this conversion. Part of #1597 Signed-off-by: David Goulet <[email protected]>
* clippy: fix `clippy::duplicated_attributes` warningsSteven Engler2025-08-111-1/+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-078-19/+21
| | | | | | | | | | | | | | 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.
* Update code for Edition 2024Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | | | | | 1. Run cargo fix --edition 2. Selectively revert the "if let"->"match" changes. These changes are meant to protect us from the lifetime changes for "if let" bindings in Rust 2024. But we're not actually relying on the old lifetime rules anywhere, and the match syntax here is quite ugly. 3. Automatically revert `$pat:expr_2021` to `$pat:expr`. (We don't actually want to restrict the expression syntax that our macros accept). Done with `git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'` 4. Run cargo fmt.
* proto: Add the ability to enforce a maximum number of cells per hopNick Mathewson2025-07-101-1/+12
|
* tor-proto: add `Notify{Sender,Receiver}` channelSteven Engler2025-06-231-0/+185
| | | | | | An async notification channel. This uses `postage::watch::{Sender,Receiver}` internally.
* tor-proto: add `DynamicRateLimitedWriter`Steven Engler2025-06-164-2/+296
| | | | | This is a `Writer` rate limiter which can receive rate limit updates from a `Stream`.
* tor-proto: fix bug in `RateLimitedWriter::poll_write`Steven Engler2025-06-082-16/+100
| | | | | | Previously it did not behave correctly when `bucket.max()` was 0 (it would sleep for 0 time instead of infinitely, triggering a debug assertion).
* tor-proto: change `wake_when_bytes_available` to `NonZero<u64>`Steven Engler2025-06-081-5/+6
|
* tor-proto: add additional unit test for `TokenBucket::adjust`Steven Engler2025-06-081-1/+57
|
* tor-proto: improve `TokenBucket::adjust`Steven Engler2025-06-081-42/+87
| | | | The token bucket is now refilled before changing the rate.
* tor-proto: rename `TokenBucket::last_refill` to `added_tokens_at`Steven Engler2025-06-081-18/+18
|
* tor-proto: return `Result` from `tokens_available_at`Steven Engler2025-06-052-32/+66
|
* tor-proto: change `RateLimitedWriter` logic to use user-configurable limitSteven Engler2025-06-051-16/+38
| | | | The user now sets a constant amount of bytes to wait for.
* tor-proto: change `ClaimedTokens::commit_fewer` to `reduce`Steven Engler2025-06-052-21/+14
|
* tor-proto: add `{TokenBucket,RateLimitedWriter}Config` typesSteven Engler2025-06-052-30/+104
|
* tor-proto: add token bucket test for token/duration calcSteven Engler2025-06-051-0/+64
|
* tor-proto: add a `RateLimitedWriter`Steven Engler2025-06-052-0/+328
|
* tor-proto: add a `TokenBucket`Steven Engler2025-06-052-0/+611
|
* tor-proto: Add error and channel types for conflux handshake outcome.Gabriela Moldovan2025-05-061-0/+13
| | | | | These will be used for sending the conflux handshake outcome to the reactor user.
* Include "bug" in all bug error messagesNick Mathewson2025-04-282-2/+2
|
* tor-proto: Add line breaks between impl blocks.Gabriela Moldovan2025-02-251-0/+4
| | | | For readability
* tor-proto: Implement From<Bug> for ReactorError.Gabriela Moldovan2025-02-251-1/+6
| | | | | | | | | | We will soon have a `ConfluxSet` type. Some of its operations will return `Bug` (for example, the method for getting the *only* leg of the conflux set will return a `Bug` if the set has no legs, or more than 1 leg). This conversion function will make it easier these errors to `ReactorError`.
* tor-async-utils: Make SometimesUnboundedSink::send_unbounded() pub(crate).Gabriela Moldovan2025-01-291-2/+1
| | | | | We are about to use this in the circuit reactor (instead of `pollish_send_unbounded`).
* proto: Notify CC when a SENDME is receivedDavid Goulet2025-01-161-0/+5
| | | | | | | | | We also pass along congestion signals that may or may not be used by our congestion control algorithm. Part of #534 Signed-off-by: David Goulet <[email protected]>
* fix: fix typosDimitris Apostolou2025-01-061-1/+1
|
* tor-proto: replaced error type of `Sender::send_and_wake`Steven Engler2024-12-101-6/+10
|
* tor-proto: add some (disabled) doc testsSteven Engler2024-12-101-0/+27
|
* tor-proto: moved `Shared::count_wakers` into 'test' modSteven Engler2024-12-101-13/+12
|
* tor-proto: changed an `expect` to a `debug_assert`Steven Engler2024-12-101-5/+4
|