aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * StreamPollSet: remove redundant type parameter VJim Newsome2024-08-122-24/+21
| | | | | | | | | | This was required to be the same type as `S::Item`. We can just use `S::Item` directly.
* | tor-proto: removed CountedHashMapJim Newsome2024-08-122-542/+0
|/ | | | | | | | | | | This was written for use in StreamMap, with an eye towards potentially reusing it elsewhere. We no longer use it in StreamMap, so it's currently unused. Probably best to go ahead and remove it now and resurrect it if we decide we want it later than to maintain dead code (or to make it more widely available without more concrete use-cases).
* 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-082-72/+68
| | | | | | This simplifies the bookkeeping a bit, and clears a path towards updating the Streams in our StreamPollSet to directly respect flow control.
* StreamMap: Put open streams in their own map instead of CountedHashMapJim Newsome2024-08-082-137/+124
| | | | | | This temporarily results in *more* bookkeeping, but is a step towards putting the mpsc receivers back into `OpenStreamEnt`, and putting the whole `OpenStreamEnt`s into the `StreamPollSet`.
* StreamMap: test n_open_streamsJim Newsome2024-08-081-1/+13
|
* StreamPollSet: allow access to inner streamsJim Newsome2024-08-082-48/+345
|
* 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.
* tor-proto streammap: Drop receiver for outgoing messages after ENDJim Newsome2024-08-061-0/+4
| | | | Fixes #1513
* tor-proto: add Debug impls and improve panic messageJim Newsome2024-08-063-2/+8
| | | | For debugging #1513
* tor-proto: Remove circuit reactor's outbound bufferJim Newsome2024-08-011-71/+13
| | | | | | | We no longer need this. StreamMap now supports handling only one outgoing message at a time while ensuring no streams starve, so we no longer ever pull messages out of the map when we're not actually ready to send them.
* tor-proto::circuit::StreamMap: Use StreamPollSetJim Newsome2024-08-013-75/+128
| | | | | | | | | | | | | | | | | | | | * Refactors `StreamMap` to use `StreamPollSet` to manage its receivers for mpsc streams. * Extends `StreamMap` to support iterating only over streams that have a pending outgoing message, and in round-robin order. * Updates `circuit::reactor::Reactor` to use this functionality. It now iterates only over streams that have a ready outgoing message, and only actually "pops" a message that is ready to be sent. This mildly simplifies the circuit reactor, but more importantly clears the way to: * Remove the "outbound queue" of messages that were pulled from stream channels but that we couldn't send yet due to congestion control. * Support opportunistic packing when preparing to send a relay message. (proposal 340). * Refactor the circuit reactor's `run_once` into futures that we can `select!` over.
* Add StreamPollSetJim Newsome2024-08-012-0/+603
|
* Add KeyedFuturesUnorderedJim Newsome2024-08-012-0/+367
|
* tor-proto::circuit: Move test-only methods into test moduleJim Newsome2024-07-291-12/+14
|
* tor-proto circuit tests: dedupe circid magic numberJim Newsome2024-07-291-6/+15
|
* tor-proto circuit test: Move to tighter scope and shadow outer defJim Newsome2024-07-291-15/+17
|
* tor-proto circuit tests: delete stale commented-out testJim Newsome2024-07-291-66/+0
|
* tor-proto circuit tests: fix some comment copy-pastaJim Newsome2024-07-291-1/+1
|
* circuit reactor: add comment pointing to tests in other moduleJim Newsome2024-07-291-1/+3
|
* Merge branch 'dev/cve/handshake_clarification' into 'main'gabi-2502024-07-151-1/+1
|\ | | | | | | | | UnverifiedChannel: Clarify check's peer_cert See merge request tpo/core/arti!2260
| * UnverifiedChannel: Clarify check's peer_certClara Engler2024-07-111-1/+1
| | | | | | | | | | | | | | This commit clarifies the documentation of the `peer_cert` parameter in the `UnverifiedChannel::check` function, in order to reflect that it represents the certificate presented during the ServerHello in the TLS handshake and not in the in-protocol CERTS cell.
* | tor-proto: Return proper `Error::MissingId`Clara Engler2024-07-121-1/+1
|/ | | | | | | | | This commit fixes a bug in the `ClientCirc::extend_ntor` function, which currently returns a `Error::MissingId(Ed25519)` in the case that no RSA identity has been found in the accompanying channel target. This behavior is obviously wrong, because a missing RSA identity should yield a `Error::MissingId(Rsa)`.
* Fix clippy::doc_lazy_continuationIan Jackson2024-07-082-3/+3
|
* Add allows for many dead code warnings in tor-protoIan Jackson2024-07-082-0/+5
| | | | | | | I'm not sure how to resolve these. See #1467. We ought to fix them before they propagate to +stable, particularly since after !2242 they'll break CI.
* Merge branch 'todo-number' into 'main'Alexander Færøy2024-07-072-2/+2
|\ | | | | | | | | Fix two TODO ticket numbers See merge request tpo/core/arti!2224
| * Fix two TODO ticket numbersIan Jackson2024-06-252-2/+2
| | | | | | | | | | I seem to have mistyped this ticket number. We meant #1397 aka "Circuit reactor isn't great", not some release ticket.
* | Rename OptTimestamp to AtomicOptTimestampNeel Chauhan2024-06-243-12/+12
|/
* Merge branch 'sometimes-unbounded' into 'main'Nick Mathewson2024-06-113-50/+266
|\ | | | | | | | | RFC: Provide and use SometimesUnboundedSender in circuit reactor See merge request tpo/core/arti!2172
| * SometimesUnboundedSink: Add a test case with some manual sequencingIan Jackson2024-05-301-0/+68
| |
| * SometimesUnboundedSink: Write commentary about WakerIan Jackson2024-05-301-0/+36
| |
| * SometimesUnboundedSink: Document some error behaviourIan Jackson2024-05-301-0/+4
| |
| * SometimesUnboundedSink: Fix a copypaste errorIan Jackson2024-05-301-1/+1
| | | | | | | | | | If only I'd used a macro for these, but that's not entirely straightforward.
| * SometimesUnboundedSink: Narrow dead code allowIan Jackson2024-05-301-2/+1
| |
| * Use SometimesUnboundedSink for the circuit reactor's bag-on-the-sideIan Jackson2024-05-291-50/+13
| |
| * Implmeent SometimesUnboundedSinkIan Jackson2024-05-292-0/+146
| |
* | Merge branch 'poll-ready-unpin-bool' into 'main'Nick Mathewson2024-05-293-12/+28
|\| | | | | | | | | Tidy up the ChannelSender::poll_ready inherent method See merge request tpo/core/arti!2171
| * ChannelSender::poll_ready_unpin_bool: add otiose ext trait docIan Jackson2024-05-291-0/+1
| |
| * ChannelSender::poll_ready_unpin_bool: move to utilIan Jackson2024-05-293-20/+24
| | | | | | | | This is where it belongs.
| * ChannelSender::poll_ready_unpin_bool: extension traitIan Jackson2024-05-292-1/+8
| | | | | | | | | | | | | | This makes this available for any Sink + Unpin. Which we want because we're about to wrap our ChannelSender in a Sink wrapper. It's in the wrong place now; we'll move it in a moment.
| * ChannelSender::poll_ready_unpin_bool: rename from poll_readyIan Jackson2024-05-292-5/+9
| | | | | | | | | | | | | | | | | | | | This would otherwise shadow the poll_ready method, which is confusing. Also this paves the way for making it available for any Sink + Unpin. Improve the docs somewhat to explain what this thing actually is.
| * ChannelSender::poll_ready inherent method: Don't discard errorIan Jackson2024-05-291-1/+1
| | | | | | | | | | | | | | | | I think this error was in fact always Error::CircuitClosed because it came from ChannelClosed.into(). Anyway, we shouldn't squash it. Now this function has semantics identical to Sink::poll_ready, just a slightly different signature.
| * ChannelSender::poll_ready inherent method: Avoid apparent discardIan Jackson2024-05-291-1/+1
| | | | | | | | Make it clear we're discarding `()`, not an actual value.
| * ChannelSender::poll_ready inherent method: Use Sink:poll_readyIan Jackson2024-05-291-1/+1
| | | | | | | | | | | | | | | | | | We're going to change this function, but first we are going to make its behaviour identical to Sink::poll_ready. This avoids open-coding the call to poll_read on cell_tx. The error handling is still strange. We'll fix that in a moment.
* | proto: Try to clarify why StreamReader has a StreamTarget.Nick Mathewson2024-05-292-3/+10
| |