aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-proto: Set kist params in channel reactor.Gabriela Moldovan2025-01-151-0/+1
|
* tor-proto: Add Channel::reparameterize_kist() API.Gabriela Moldovan2025-01-151-0/+9
| | | | | This will enable us to update the channel's KIST configuration whenever there is a change in the consensus or config.
* tor-proto: Pass a StreamOps handle to the channel reactor.Gabriela Moldovan2025-01-151-0/+2
|
* tor-rtcompat: Big invasive change adding StreamOps bound everywhere.Gabriela Moldovan2025-01-151-3/+3
| | | | | | This is unfortunately necessary, because after the channel handshake, we need to give the channel reactor a `StreamOps` handle to the underlying stream.
* tor-proto: Add KistParams type built from NetParameters.Gabriela Moldovan2025-01-151-0/+1
| | | | | | | | Note: this commit makes `tor-proto` depend on `tor-netdir` (because it adds a `KistParams` type that is buildable from `NetParameters`, which is defined in `tor-netdir`). Closes #1729
* tor-proto: make `Channel::wait_for_close` non-experimentalSteven Engler2025-01-091-1/+0
|
* tor-proto: `Channel::wait_for_close` return success statusSteven Engler2025-01-091-8/+37
| | | | | | This had a TODO about returning a "status indication instead of just ()" so this commit adds some status indication that we can expand later if needed.
* tor-proto: removed `Receiver::recv_clone` and implemented `IntoFuture` for ↵Steven Engler2024-12-101-1/+2
| | | | `Receiver`
* tor-proto: update docs on `Channel::reactor_closed_rx`Steven Engler2024-12-101-3/+1
| | | | | This is no longer applicable with the new oneshot broadcast channel design.
* tor-proto: replace oneshot broadcast channelSteven Engler2024-12-101-1/+1
| | | | | The old version had some issues, so this is a rewrite which uses slightly lower level synchronization types (`Mutex` and `OnceLock`).
* tor-proto: replace `Channel`s "closed" state handlingSteven Engler2024-12-101-26/+17
| | | | | | | | | | | | | | | Previously `Channel` had two concepts of "closed". There was an atomic flag that was set to `true` at the end `Reactor::run`, and an experimental oneshot channel where the sender was dropped when the reactor was dropped. This commit consolidates these two using the `oneshot_broadcast` module. This means that the behaviour is consistent between both "closed" statuses (`is_closing()` and `wait_for_close()`). A channel is considered closed when its reactor is dropped. This also helps progress towards making the channel reactor cancellation safe (see arti#1756).
* tor-proto: move `ChannelDetails::reactor_closed_rx` to `Channel`Steven Engler2024-12-101-11/+17
| | | | This doesn't need to be shared with the reactor.
* memquota: Fix circuit account lifetime (fmt)Ian Jackson2024-10-211-1/+8
|
* memquota: Fix circuit account lifetime (clippy churn)Ian Jackson2024-10-211-1/+1
| | | | | | Now that it doesn't call CircuitAccount::new() it has no error paths, and clippy demands we remove the Result, so it must once again become infallible.
* memquota: Fix circuit account lifetimeIan Jackson2024-10-211-1/+1
| | | | | | | | We foolishly made *two* CircuitAccounts, one of which gets immediately dropped. But we need to hold onto the account somewhere, because an mq_queue doesn't keep the account alive. Otherwise everything breaks when mq tracking is enabled.
* Apply deferred rustfmt churnIan Jackson2024-10-091-1/+1
|
* memquota: Use an mq_queue for channel->circuit RX queueIan Jackson2024-10-091-4/+6
| | | | | | Fixes #1682. (This involves some noise in the tests.)
* memquota: Add docs and TODOs re inbound channel->circuit dataIan Jackson2024-10-091-0/+1
| | | | | See https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2509#note_3089913
* tor-proto: Remove the no-longer needed allowsIan Jackson2024-10-031-1/+0
|
* tor-proto: channel: Provide time_provider accessorsIan Jackson2024-10-031-0/+17
| | | | This will save circuits etc. keeping their own clone of the time provider.
* tor-proto: Make circuit->channel queues participate in memquotaIan Jackson2024-10-031-9/+11
| | | | | | | | We use the *channel*'s memquota account. This is arguably wrong, but it's hard to get right now. See #1652. Change the type of the queue, and the places it's constructed. The use sites can all stay the same.
* tor-proto: Introduce a fake_mpsc helper for channel testsIan Jackson2024-10-031-2/+11
| | | | | This provides a nice place to change in the tests, when we want to change the way the queue is made.
* tor-proto: Plumb the ChannelAccount through to queue creation siteIan Jackson2024-10-031-2/+20
| | | | | This gets it as far as the outbound circuit->channel mpsc queue creation. Also, we provide an accessor for it.
* tor-proto: Plumb the ChannelAccount through to queue creation site (pre-fmt)Ian Jackson2024-10-031-1/+5
|
* tor-proto: Make PendingClientCirc::new fallible (fmt)Ian Jackson2024-10-031-7/+1
|
* tor-proto: Make PendingClientCirc::new fallibleIan Jackson2024-10-031-2/+2
|
* tor-proto: channel: Make construction fallibleIan Jackson2024-10-031-2/+3
| | | | | Making a channel is going to involve making a memquota Participant, which can fail.
* tor-proto: Add a CoarseTimeProvider bound to all the SleepProvidersIan Jackson2024-10-011-3/+3
| | | | | | | The memquota arranagements are going to use this. We *don't* apply this to Channel (or to other types that aren't already generic over SleepProvider).
* 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.
* `tor_proto::channel`: update comment to point to `tor-chanmgr`Jim Newsome2024-08-271-2/+1
|
* Fix clippy::doc_lazy_continuationIan Jackson2024-07-081-2/+2
|
* Rename OptTimestamp to AtomicOptTimestampNeel Chauhan2024-06-241-4/+4
|
* ChannelSender::poll_ready_unpin_bool: move to utilIan Jackson2024-05-291-19/+0
| | | | This is where it belongs.
* ChannelSender::poll_ready_unpin_bool: extension traitIan Jackson2024-05-291-1/+7
| | | | | | | 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-291-2/+6
| | | | | | | | | | 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.
* Remove an outdated comment.Nick Mathewson2024-05-201-3/+0
|
* Make an arc clone explicit.Nick Mathewson2024-05-201-1/+1
|
* Fix a typo.gabi-2502024-05-201-1/+1
|
* proto: Divide up some elements of ChannelDetails.Nick Mathewson2024-05-161-50/+54
| | | | | | | | | | | | | | Previously ChannelDetails had a double duty: It held elements shared among the clones of a Channel, and it also held elements shared between the Channel and the Reactor. But now that Channel doesn't have to implement Clone, we can more the non-Reactor elements into Channel itself. This change may improve cache locality a bit, and should make it a little easier to follow the channel code. I've also moved unique_id out of ChannelDetails into Channel _and_ Reactor: it is small, immutable, and used all the time in logging.
* Make Channel non-Clone.Nick Mathewson2024-05-161-2/+2
|
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-161-4/+4
| | | | | | | | | | | | | | | | Previously, Channel was a type that you could Clone that implicitly its state. Now, Channel always appears as an Arc<Channel>. This change has several benefits: * It makes the relationship between Channel struct and the underlying channel more clear. * It enables Channel to participate in the RPC system, where everything has to be an Arc<.> * It enables us to have a Weak<Channel>, if we ever want to. * It will let us move various members out of ChannelDetails. We did this change a while ago with ClientCirc.
* proto: Move Channel send functionality into a separate type.Nick Mathewson2024-05-161-39/+51
| | | | | | | | | | | | This serves three purposes: * It removes the 'send a cell' method from the channel's public API. Nothing outside of tor-proto should have to use this. * It paves the way for giving each circuit a separate handle onto the channel's send functionality. This will eventually let the channel multiplex among circuits more intelligently. * It prepares for the next commit, which will make Channel itself universally Arc<.>ed.
* proto: Document ChannelDetails members that don't need to be shared.Nick Mathewson2024-05-161-1/+7
|
* proto: Document usage for each mutable part of ChannelDetailsNick Mathewson2024-05-161-1/+12
| | | | | For all mutable shared state, we ought to know which part of the program sets it, which part of the program reads it, and why.
* Fix typos in doc commentsTobias Stoeckmann2024-03-061-1/+1
|
* Add a caret_int HandshakeType for HTYPE constantsJim Newsome2023-10-261-1/+5
|
* Change `CircId` to never be zeroJim Newsome2023-10-251-4/+4
| | | | | | | | | | This changes the internal representation to be `NonZeroU32` instead of just `u32`. Various places where a circuit ID is optional now use `Option<CircId>`. Fixes a bug in `CircIdRange::sample` that would previously return a circuit ID of 0, when the rng returned 0x8000_0000 for a low range.