summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* tor-proto: CreateFastWrap::decode_chanmsg: Do not report handshakeIan Jackson2023-01-061-1/+1
| | | | | The debug impl prints the handshake challenge, which we should probably treat as sensitive.
* tor-proto: When relay IDs mismatch, the IDs are sensitive in errorsIan Jackson2023-01-061-1/+3
|
* proto: Make Channel::reparameterize take &self.Nick Mathewson2022-10-181-1/+1
| | | | | | | | | | Even though channels are practically changeable, they use locks internally so that you don't need a `&mut Channel` to send or receive traffic. It makes sense for reparameterizing the channel to also use a &self reference. I'll need this so that I can store channels in an `ByRelayIds<>` set, and still invoke their reparameterize methods.
* proto: Implement HasRelayIds for Channel.Nick Mathewson2022-10-181-0/+9
|
* Change multiplicity of ChannelMethod and addressesNick Mathewson2022-10-111-4/+4
| | | | | | | Now each `ChanTarget` has at most one `ChannelMethod`, and only `Direct` `ChannelMethods` can have multiple addresses. Closes #600.
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-061-4/+20
| | | | These are now builders.
* tor-proto: Preserve the ChannelMethod, not the SocketAddrNick Mathewson2022-10-061-11/+20
|
* channel engage_padding_activities: swap docs to tor0protoIan Jackson2022-08-171-1/+11
| | | | This allow us to make a working cross-reference.
* channel fake_channel_details: Use precise cfgIan Jackson2022-08-171-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826169
* Rename ChannelsParams types to ChannelPaddingInstructionsIan Jackson2022-08-171-4/+4
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826167 This makes some lines too long; I will run rustfmt in a separate commit for clarity.
* Channel: Make mutable() and engage_padding_activities infallibleIan Jackson2022-08-171-6/+5
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826151 This gets rid of quite some Bug error paths.
* Move ChannelUsage from tor_proto to tor_chanmgrIan Jackson2022-08-171-55/+26
| | | | | | | | | | | Replace Channel::note_usage with Channel::engage_padding_activities, which unconditionally causes the channel to (start to) do netflow padding things. The condition now lives in chanmgr. Addresses https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826094
* channel: Clarify (and in some places replace) "frontend" terminologyIan Jackson2022-08-171-4/+5
|
* chanmgr ChannelUsage: Fix and clarify docsIan Jackson2022-08-171-2/+3
|
* tor-proto, testing: Provide new_fake_channelIan Jackson2022-08-161-0/+22
| | | | To test the padding control we will want this.
* tor-proto, testing: Make fake_channel_details availableIan Jackson2022-08-161-16/+18
| | | | Now it's not just cfg(test), but feature testing.