aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/util
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* tor-proto: use thiserror for `SenderDropped`Steven Engler2024-12-101-9/+2
|
* tor-proto: use `ready!` instead of `match`Steven Engler2024-12-101-5/+3
|
* tor-proto: `borrowed()` now explicitly returns a `BorrowedReceiverFuture`Steven Engler2024-12-101-3/+2
|
* tor-proto: improve commentsSteven Engler2024-12-101-15/+31
|
* Revert "tor-proto: implement `FusedFuture` for receiver futures"Steven Engler2024-12-101-57/+10
| | | | This reverts commit d73f8894551d37e3bc36947eccf0c6007ffc066e.
* tor-proto: implement `FusedFuture` for receiver futuresSteven Engler2024-12-101-10/+57
|
* Revert "tor-proto: deduplicate future fields into `FutureState`"Steven Engler2024-12-101-18/+11
| | | | This reverts commit acc79ffb44343e52ecb72e27ee8843a63448ff5a.
* Revert "tor-proto: implement `FusedFuture` for receiver futures"Steven Engler2024-12-101-79/+33
| | | | This reverts commit 2fd105b79c25d919e32e53daf81cb369d1e44331.
* tor-proto: implement `FusedFuture` for receiver futuresSteven Engler2024-12-101-33/+79
| | | | | | | | I considered just using `FutureExt::fuse`, but that becomes a little annoying since the future type is exposed through `IntoFuture::IntoFuture`, which means `ReceiverFuture` would need to wrap a `Fuse`. I figured it's cleaner just to implement the trait directly.
* tor-proto: deduplicate future fields into `FutureState`Steven Engler2024-12-101-11/+18
|
* tor-proto: renamed `ReceiverBorrowedFuture` to `BorrowedReceiverFuture`Steven Engler2024-12-101-5/+5
|
* tor-proto: renamed `ReceiverOwnedFuture` to `ReceiverFuture`Steven Engler2024-12-101-6/+6
|
* tor-proto: rename `Receiver::recv` to `borrowed`Steven Engler2024-12-101-24/+24
|
* tor-proto: moved the `Weak::upgrade` into `Sender::send_and_wake`Steven Engler2024-12-101-22/+15
|
* tor-proto: changed `wakers` from an `Option<_>` to a `Result<_, ↵Steven Engler2024-12-101-9/+21
| | | | WakersAlreadyWoken>`
* tor-proto: added `use std::ops::Drop`Steven Engler2024-12-101-3/+4
|
* tor-proto: removed `Receiver::recv_clone` and implemented `IntoFuture` for ↵Steven Engler2024-12-101-24/+22
| | | | `Receiver`
* tor-proto: renamed `CancelledError` to `SenderDropped`Steven Engler2024-12-101-17/+17
|
* tor-proto: switched from `Slab` to `DenseSlotMap` for waker mapSteven Engler2024-12-101-10/+12
|
* tor-proto: change the message type from `Option<T>` to `Result<T, ↵Steven Engler2024-12-101-9/+12
| | | | CancelledError>`
* tor-proto: changed regular comments on `Shared` to doc commentsSteven Engler2024-12-101-21/+21
|
* tor-proto: replace oneshot broadcast channelSteven Engler2024-12-101-137/+561
| | | | | The old version had some issues, so this is a rewrite which uses slightly lower level synchronization types (`Mutex` and `OnceLock`).
* tor-proto: add 'oneshot_broadcast' util moduleSteven Engler2024-12-101-0/+245
|