summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/stream
Commit message (Collapse)AuthorAgeFilesLines
* Convert StreamId to NonZeroU16Jim Newsome2023-10-251-1/+1
|
* proto: Revise the behavior of IncomingStream::discard().Nick Mathewson2023-10-191-9/+12
| | | | | | | | | | | | | Because dropping a `StreamTarget` causes the circuit reactor to send an End, the previous do-nothing implementation of `discard()` wasn't sufficient to cause the request to be ignored without sending an End. This commit modifies our "close pending stream" behavior to only optionally send an End message. To avoid confusion, I'm using a new `CloseStreamBehavior` enum rather than an `Option<End>`, since we had previously used `None` in some cases to indicate a default (misc) end message.
* IncomingStream:: flatten IncomingStreamInner.Nick Mathewson2023-10-191-13/+11
|
* IncomingStream: Remove state.Nick Mathewson2023-10-191-67/+4
| | | | | | Now that every state-change function consumes the IncomingStream, there is no longer any reason to keep track of an internal state enum.
* Note a bug in IncomingStream::discard.Nick Mathewson2023-10-191-0/+2
|
* Remove IncomingStreamInner from its Option.Nick Mathewson2023-10-191-34/+7
| | | | | Now that IncomingStream doesn't implement Drop, we can just destructure it.
* Remove impl Drop from IncomingStreamNick Mathewson2023-10-191-11/+4
| | | | | Since dropping a StreamTarget will send an End, we don't need to call reject_internal in this case.
* proto: Make StreamTarget::close() misuse less likely.Nick Mathewson2023-10-171-3/+4
| | | | | | | | | It turns out that we can make `IncomingStream::reject()` consume self, thus making it impossible to hit the double-close error from outside the `tor-proto` crate. Also, we rename `StreamTarget::close()` to `close_pending()` to better reflect its limited applicability.
* proto::stream::incoming: Use bit-array representation for command listNick Mathewson2023-10-121-7/+84
| | | | | This should be smaller and faster than vec, and save some allocations. It could also avoid a tiny sidechannel.
* tor-proto: remove a now-unneeded allow in stream::incomingNick Mathewson2023-10-121-2/+0
|
* oneshot: Apply deferred rustfmt churnIan Jackson2023-10-111-1/+1
| | | | cargo fmt, precisely.
* oneshot: Use veneer in tor-protoIan Jackson2023-10-111-1/+1
|
* tor-proto: Make some imports more preciseIan Jackson2023-08-231-1/+3
| | | | | | | | A warning is getting in my way when I run cargo clippy -p tor-hsservice --all-features See also https://gitlab.torproject.org/tpo/core/arti/-/issues/1006#note_2932088
* tor-proto: Make update_state() and discard() return Result<(), Bug>.Gabriela Moldovan2023-08-091-5/+5
| | | | These functions only ever return `Bug` errors.
* tor-proto: Implement IncomingStream::discard().Gabriela Moldovan2023-08-081-2/+2
|
* tor-proto: Replace boolean flags with an IncomingStreamState enum.Gabriela Moldovan2023-08-081-18/+56
| | | | | | | | | | This commit introduces an `IncomingStreamState` enum, which indicates whether the stream was accepted, discarded, or rejected, or if it is still pending. The `is_rejected`/`is_accepted` boolean flags are no longer needed. Without this change, we'd need to introduce yet another boolean flag when we implement `discard()` (for the "discarded" state).
* Merge branch 'tor-proto-incoming-todo' into 'main'gabi-2502023-08-081-18/+15
|\ | | | | | | | | tor-proto: Replace IncomingStreamMsg with IncomingStreamRequest. See merge request tpo/core/arti!1477
| * tor-proto: Replace IncomingStreamMsg with IncomingStreamRequest.Gabriela Moldovan2023-08-071-18/+15
| | | | | | | | | | | | | | | | The two enums essentially serve the same purpose, so we don't need both of them. This also addresses the TODO that says we should return an error if `accept_data` is called for a RESOLVE stream.
* | tor-proto: Fix broken docs.Gabriela Moldovan2023-08-081-1/+1
| |
* | tor-proto: Make it obvious that we're discarding a Result.Gabriela Moldovan2023-08-081-1/+1
| |
* | tor-proto: Make StreamTarget::close return the oneshot::Receiver instead of ↵Gabriela Moldovan2023-08-081-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | blocking. Instead of having 2 version of `StreamTarget::close` (a blocking one and a nonblocking one), we can just return the `oneshot::Receiver` for receiving the reactor's response and let the caller of `StreamTarget::close` decide whether to block. This allows us to reduce some code duplication in the `IncomingStream` implementation.
* | tor-proto: Make take_inner() use mut_inner() to check the inner value.Gabriela Moldovan2023-08-081-3/+6
|/
* tor-proto: Implement `Drop` for `IncomingStream`.Gabriela Moldovan2023-08-071-11/+64
|
* tor-proto: Keep track of whether the `IncomingStream` was accepted.Gabriela Moldovan2023-08-071-0/+5
| | | | | The behaviour of `IncomingStream::drop` is going to depend on whether the stream was accepted or not.
* tor-proto: Rename misleading field in `DataCmdChecker`.Gabriela Moldovan2023-08-071-13/+16
| | | | | | | | This is a follow-up from !1451. This commit solves a `TODO HSS` introduced when `DataCmdChecker` got an additional constructor (`new_connected`) for creating "pre-connected" streams. See f6745d31 for more details.
* tor-proto: Implement IncomingStream::{accept_data, request, reject}.Gabriela Moldovan2023-08-031-6/+32
|
* tor-proto: Remove extraneous space.Gabriela Moldovan2023-08-031-1/+1
|
* tor-proto: Add constructors for pre-connected DataStreams.Gabriela Moldovan2023-08-031-2/+41
| | | | | | | | | When accepting a new stream, hidden services, exit relays and dirauths don't wait for a `CONNECTED` cell from the initiator. This commit adds constructors for building `DataStream`s and `DataCmdChecker`s that can immediately receive data cells (and don't expect to receive `CONNECTED` cells at all).
* tor-proto: Add a constructor for IncomingStream.Gabriela Moldovan2023-08-031-0/+13
|
* tor-proto: Add imports for commonly used types.Gabriela Moldovan2023-08-031-4/+4
|
* tor-proto: Add IncomingCmdChecker for IncomingStream.Gabriela Moldovan2023-08-031-2/+59
|
* Remove explicit allows for missing_panics_docs.Nick Mathewson2023-07-061-6/+1
| | | | These are no longer needed.
* proto: downgrade some "TODO HS" comments to "HSS"Nick Mathewson2023-06-211-5/+5
| | | | | These are all related to issues that will come up for the service side of the onion service implementation.
* Add "TODO RPC" notes around DataStreamCtrl per review.Nick Mathewson2023-05-242-0/+16
|
* proto: Add stream-status functionality to DataStreamCtrl.Nick Mathewson2023-05-241-2/+106
| | | | There are some weaknesses and problems here; see TODO notes.
* proto: Create a `DataStreamCtrl` type.Nick Mathewson2023-05-222-1/+108
| | | | | | | | | | | | | | | | | The idea here is that we want to make DataStream visible to the RPC system without requiring that the RPC session hold the DataStream itself (or the Reader, or the Writer). We could solve this problem by making _all_ the state in the DataStream shared, but that would introduce unnecessary extra locking in our critical path. Instead we're creating the notion of a "control handle" that lets you manage and observe a stream without actually owning the stream. Right now the only supported functionality is asking for the stream's circuit. Part of #847
* Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-161-1/+1
| | | | | | | | | | | | Now ClientCirc is no longer `Clone`, and the things that need it to be `Clone` instead return and use an Arc<ClientCirc> We're doing this so that ClientCirc can participate in the RPC system, and so that its semantics are more obvious. Closes #846. Thanks to the type system, this was a much simpler refactoring than I had feared it would be.
* Add some missing importsIan Jackson2023-03-281-1/+4
| | | | | | | | Now nailing-cargo +stable clippy -p tor-hsclient --all-features --all-targets actually works. squash! Add some missing imports
* Add an experimental circuit accessor to DataStream.Nick Mathewson2023-03-231-2/+28
| | | | Closes #784.
* proto: Tweak documentation and names around CmdChecker.Nick Mathewson2023-02-273-8/+16
|
* tor-proto: Introduce CmdChecker, and define it for our streams.Nick Mathewson2023-02-173-0/+147
| | | | | | | | The role of CmdChecker is to verify that messages are arriving at the appropriate sequence on a stream, with respect to the other messages that have been received. Once the stream becomes half-closed, the CmdChecker is also in charge of consuming incoming messages on the stream and making sure that they are well-formed.
* tor-proto: note implications for future HS workNick Mathewson2023-02-151-0/+2
|
* tor-proto: Push stream message parsing into the stream objects.Nick Mathewson2023-02-153-31/+67
| | | | | This closes #525, and ensures, at last, that we don't parse any message that we wouldn't accept.
* tor-cell: Rename RelayMsg and RelayCell-related types.Nick Mathewson2023-02-073-14/+14
| | | | Thanks to rust-analyzer for making this simple.
* tor-cell: Remove RelayMsg methods that are duplicated in RelayMsgClass.Nick Mathewson2023-02-072-0/+2
|
* tor-proto: Draft API to handle incoming BEGIN requests.Nick Mathewson2023-01-171-0/+67
| | | | Onion services (and later, exits and caches) will need this.
* proto: Only ready a DataStream if CONNECTED was succesfully receivedDavid Goulet2022-05-311-1/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* Move skip_fmt into tor-basic-utilsIan Jackson2022-03-041-1/+1
| | | | | | | Code motion and the minimal mechanical changes. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
* Replace manual Debug impls with educe in tor-protoIan Jackson2022-03-021-32/+23
| | | | We now print slighly more information.
* tor-proto datastream: Fix typo in Debug implIan Jackson2022-02-251-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/353#note_2781632