summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* oneshot: Apply deferred rustfmt churnIan Jackson2023-10-111-1/+1
| | | | cargo fmt, precisely.
* oneshot: Use veneer in tor-protoIan Jackson2023-10-111-1/+2
|
* tor-proto: Fix dead_code when building without experimental-apiNick Mathewson2023-08-161-0/+1
|
* proto: methods to wait until a channel/circuit is shut down.Nick Mathewson2023-08-041-1/+21
| | | | | | | | | | | | | | | | | | The implementation here is perhaps excessively simple: we put a `oneshot::Sender` in the `Reactor` object, and a `Shared<oneshot::Receiver>` in the circuit or channel. When the reactor is dropped, any copy of the `Shared<Receiver>` will yield `Err(Cancelled)`. I'm marking these methods as experimental because I'm not sure I've thought of all the implications here, and we might want to change things around. Down the road, these methods might want to yield a `Result<>` indicating why the reactor was shut down. This feature was inspired by a request from Saksham Mittal, and a felt need while working on !1472.
* proto: document channel lifecycle better.Nick Mathewson2023-06-281-5/+24
|
* Rename OpenClientChan{Msg,Cell} => OpenChan{Msg,Cell}S2CNick Mathewson2023-02-091-8/+8
|
* tor-proto: Do not parse forbidden commands on inbound cells.Nick Mathewson2023-02-091-2/+32
| | | | | | | | | | Unlike C tor, we treat unrecognized commands as reason to kill off the connection entirely. That's fine; if we need to add an unrecognized command in the future, we can use VERSIONS to negotiate it. Also, if someday we want this code to support relay channels as well, we can use some type trickery to have that work too.
* tor-proto: only parse allowed ChanMsg types during handshake.Nick Mathewson2023-02-091-1/+3
|
* tor-cell: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-071-13/+13
|
* tor-cell: Remove ChanMsg methods that are duplicated in ChanMsgClass.Nick Mathewson2023-02-071-0/+1
|
* tor-cell: Use macro to generate ChanMsg too.Nick Mathewson2023-02-071-1/+1
|
* Fix typosDimitris Apostolou2023-01-071-1/+1
|