summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/util
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* tor-proto: Remove the no-longer needed allowsIan Jackson2024-10-031-1/+0
|
* tor-proto: Provide a variant for memquota errorsIan Jackson2024-10-031-0/+6
|
* tor-proto: SometimesUnboundedSink: provide as_inner accessorIan Jackson2024-10-021-0/+10
|
* Fix typosDimitris Apostolou2024-09-031-2/+2
|
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-281-1/+1
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* StreamPollSet: disallow polling ready streamsJim Newsome2024-08-211-22/+28
|
* tor-proto: Use PeekableStream to get rid of redundant bufferingJim Newsome2024-08-211-180/+217
| | | | | | | | | | | | | | | | | | | | | | | | | * Update `StreamPollSet` to require that its streams implement `PeekableStream`, and to not do its own buffering of values read from the stream. This avoids an extra layer of buffering for streams that already buffer a value, and makes the interior state a little simpler and more robust. It does have a downside of making the API a little less convenient, since the caller must do its own `poll_peek` call if it wants a reference to the item. * Update `StreamMap` to implement `PeekableStream` for `OpenStreamEntStream`, as it must to satisfy the updated `StreamPollSet` API. We have to somewhat constrain the `poll_ready_streams_iter` API to no longer return both a reference to the stream and the message. I don't see a way to return both while satisfying the borrow checker. Luckily we don't really need both anymore. * Update the Circuit reactor to handle the updated `StreamMap::poll_ready_streams_iter` API.
* StreamPollSet: remove redundant type parameter VJim Newsome2024-08-121-23/+20
| | | | | This was required to be the same type as `S::Item`. We can just use `S::Item` directly.
* StreamPollSet: replace nested OptionJim Newsome2024-08-081-10/+28
| | | | | | | | | | | | | | | | | Bullied by clippy. I'm on the fence whether this is actually an improvement, or whether I should add an exception. ``` error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases --> crates/tor-proto/src/util/stream_poll_set.rs:106:56 | 106 | pub fn remove(&mut self, key: &K) -> Option<(K, P, Option<Option<V>>, S)> { | ^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option = note: `-D clippy::option-option` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::option_option)]` ```
* StreamMap: Merge rxs into open_streamsJim Newsome2024-08-081-0/+5
| | | | | | This simplifies the bookkeeping a bit, and clears a path towards updating the Streams in our StreamPollSet to directly respect flow control.
* StreamPollSet: allow access to inner streamsJim Newsome2024-08-081-39/+334
|
* KeyedFuturesUnordered: explicitly document Stream behaviorJim Newsome2024-08-081-0/+13
|
* KeyedFuturesUnordered: return actual referencesJim Newsome2024-08-081-23/+10
| | | | | | We can actually return references here instead of `impl Deref`, simplifying this code a bit and follow-on code to use this in StreamPollSet.
* KeyedFuturesUnordered: additional testingJim Newsome2024-08-081-37/+98
| | | | | | | | | Primarily I wanted to exercise the code path that we get a spurious wakeup due to a future that was removed from the map later becoming ready. I also ended up merging ReadyFut and PendingFut into a more flexible ValueFut to make this a little nicer.
* Add KeyedFuturesUnordered::get and KeyedFuturesUnordered::get_mutJim Newsome2024-08-081-3/+72
|
* KeyedFuturesUnordered::remove: return the future as wellJim Newsome2024-08-082-18/+55
|
* KeyedFuturesUnordered: refactor so that futures are accessibleJim Newsome2024-08-082-100/+100
| | | | | | | | | | | Instead of wrapping `FuturesUnordered`, which doesn't support efficient access to its internal futures, keep the futures themselves in our own HashMap, and use a custom Waker to be notified which futures are ready to be polled. *Almost* a pure refactor in this step - the implementation now requires that keys are `Send + Sync + 'static` so that we can put them inside an `Arc` and send them over a channel.
* Add StreamPollSetJim Newsome2024-08-011-0/+602
|
* Add KeyedFuturesUnorderedJim Newsome2024-08-011-0/+366
|
* Merge branch 'todo-number' into 'main'Alexander Færøy2024-07-071-1/+1
|\ | | | | | | | | Fix two TODO ticket numbers See merge request tpo/core/arti!2224