aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/circuit.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* | tor-proto: Reinstate circuit hop check in test_create()Neel Chauhan2024-10-161-4/+1
|/
* Replace _ => panic!() in tor-protoIan Jackson2024-10-151-14/+14
|
* Merge branch 'mq-circ' into 'main'David Goulet2024-10-101-9/+11
|\ | | | | | | | | | | | | Use memquota queue for channel->circuit RX data Closes #1682 See merge request tpo/core/arti!2518
| * Apply deferred rustfmt churnIan Jackson2024-10-091-4/+1
| |
| * memquota: Use an mq_queue for channel->circuit RX queueIan Jackson2024-10-091-4/+4
| | | | | | | | | | | | Fixes #1682. (This involves some noise in the tests.)
| * memquota: Introduce type aliases for channel->circuit RX queueIan Jackson2024-10-091-4/+9
| | | | | | | | | | This is neater and will make changing the type (in a moment) less noisy.
* | tor-proto: Fix flaky circuit::test::accept_valid_sendme test.Wesley Aptekar-Cassels2024-10-071-4/+3
|/ | | | Fixes: #628
* tor-proto: Remove the no-longer needed allowsIan Jackson2024-10-031-1/+0
|
* tor-proto: Make incoming stream requests participate in memquota (fmt)Ian Jackson2024-10-031-2/+2
|
* tor-proto: Make incoming stream requests participate in memquotaIan Jackson2024-10-031-1/+3
|
* tor-proto: Make stream queues participate in memquota (fmt)Ian Jackson2024-10-031-2/+2
|
* tor-proto: Make stream queues participate in memquotaIan Jackson2024-10-031-6/+13
| | | | Change the typss of StreamMpscSender and StreamMpscReceiver.
* tor-proto: Put a StreamAccount in DataStream etc.Ian Jackson2024-10-031-2/+5
|
* tor-proto: Put a CircuitAccount in ClientCirc and circuit::ReactorIan Jackson2024-10-031-1/+12
|
* tor-proto: Make PendingClientCirc::new fallibleIan Jackson2024-10-031-4/+5
|
* Merge branch 'mpsc-types' into 'main'Ian Jackson2024-10-021-1/+15
|\ | | | | | | | | tor-proto: Introduce type aliases for some queues See merge request tpo/core/arti!2484
| * tor-proto: Introduce type aliases for stream queues (fmt)Ian Jackson2024-10-021-4/+3
| |
| * tor-proto: Introduce type aliases for stream queuesIan Jackson2024-10-021-1/+16
| | | | | | | | This will make it easier to change their types.
* | tor-proto: Use trait methods for try_send and channel_closeIan Jackson2024-10-011-1/+3
|/ | | | This prepares us to change the types of these queues.
* 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.
* `circuit` docs: delete comment about no flow-control etcJim Newsome2024-08-261-2/+0
| | | | | There is now (sendme-style) flow control, and some fairness (via round robin scheduling of streams).
* `circuit` docs: delete "one big mutex" limitationJim Newsome2024-08-261-3/+0
| | | | | | There is a mutex for some of the "mutable state", but the reactor only needs to lock it when adding a hop. It's not needed "to process a cell" or when streams send. Probably not worth calling out here.
* tor-proto circuit: add unit test for fairnessJim Newsome2024-08-221-0/+128
|
* 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
|
* 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)`.
* proto: Add a test for closing streams.Nick Mathewson2024-05-291-1/+74
| | | | | | | | | | | | | This test verifies that when we invoke the code to close a stream, an END message is actually sent. The test comes in two versions: * `drop_stream` closes the stream by dropping it. It currently passes on main. * `close_stream` closes the stream by running `AsyncWriteExt::close` on the writer. It is a regression test for #1368. It currently fails on main.
* proto: Improve documentation about DataStream lifetimes and closingNick Mathewson2024-05-291-1/+10
| | | | | | | In particular, clarify that dropping the DataWriter on its own does nothing unless the DataReader is also dropped. Related to #1368.
* proto: Make DataWriter::close actually do something.Nick Mathewson2024-05-291-0/+14
| | | | | | | | | | | | | | | | | | | Previously we had a bug where `<DataWriter as AsyncWrite>::close` (or `shutdown` in tokio-land) would not actually have any effect. It _would_ drop the `StreamTarget` held by the `DataWriter`, but since the `DataReader` also held a `StreamTarget`, the MPSC channel would not get closed, and the circuit reactor would not realize that the stream wanted to shut down. Now we use `mpsc::Sender::close_channel` to make our closes effectual. Closes #1368. Additionally, we fix a bug where `poll_close()` never actually did anything if the buffer had nothing in it when it was called. Previously, `poll_flush_impl()` would exit immediately if it had no data to flush. That isn't what we want when we are closing!
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-161-5/+10
| | | | | | | | | | | | | | | | 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: Fix compilation with stream-ctrl but not experimental-api.Nick Mathewson2024-05-141-1/+1
|
* Make filter conditional, to fix build with hs-service disabled.Nick Mathewson2024-03-261-0/+3
|
* Rename the old IncomingStreamRequestContext to StreamReqInfo.Nick Mathewson2024-03-261-2/+2
| | | | (Doing this to prevent us having two structs with the same name.)
* Add an IncomingStreamRequestFilter to check early propertiesNick Mathewson2024-03-261-1/+24
| | | | | | | Based on designs in #1124. Note that there is a TODO here about a hack I had to do to appease the borrow checker.
* We now need circuit::handshake to exist unconditionally.Nick Mathewson2024-03-261-0/+4
|
* Refactor the logic for constructing crypt layers.Nick Mathewson2024-03-261-13/+4
| | | | | | | | | | | The key insights here are: - That relay cell format and crypto protocols aren't orthogonal: Once we have GCO, it will require V1. - That we only need the actual functions for layer construction to be generic; we don't need to proliferate generic parameters everywhere. - That the circuit::handshake module already does most of what we want.
* Add and use RelayCellFormatTraitJim Newsome2024-03-201-2/+10
| | | | | | This lets us paramaterize types and functions by a particular relay cell format. We use this e.g. to statically parameterize the cell crypto functions, thereby removing some run-time branching in the hot path.
* Propagate RelayCellFormat selection up to where format decisions will be madeJim Newsome2024-03-201-1/+9
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* relay-cell: Update relay cell decoding API for prop340Jim Newsome2024-03-121-7/+25
| | | | | | | | | | | Prop 340: https://spec.torproject.org/proposals/340-packed-and-fragmented.html This updates the decoding API to support multiple versions of the relay cell encoding, including the new encoding proposed in prop340 that supports relay message packing and fragmentation. This commit doesn't actually add support for that new encoding yet.
* tor-proto: Add function for peeking at pending circ unique ID.Gabriela Moldovan2024-02-271-0/+5
| | | | | | | | | `tor_circmgr::Error::Protocol` will soon include an optional `UniqId`. Since `Protocol` errors can be caused by pending circuits, we need to be able to peek at their `UniqId`. Part of #1297
* Merge branch 'send_incoming_request_failures' into 'main'gabi-2502024-01-171-9/+8
|\ | | | | | | | | | | | | Several clean-ups around failures in incoming stream request handlers. Closes #1190, #1189, and #1188 See merge request tpo/core/arti!1892
| * Give an error on duplicate call to allow_stream_requests.Nick Mathewson2024-01-171-6/+0
| | | | | | | | Closes #1190
| * proto: Close circuit _intentionally_ when Request Sink is dropped.Nick Mathewson2024-01-171-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In theory, it might be better to just un-register the IncomingStreamRequestHandler when the Receiver for the stream requests is dropped. However, there are two reasons not to do so: 1. It's tricky. We never actually poll on the corresponding Sink, so there isn't a place where the Reactor would expect to get a prompt notification of closure. We only find out that the Receiver has been dropped when an attempt to send on the Sink returns an `is_disconnected` error. 2. It's unnecessary. In the Tor protocols, once we have decided to accept incoming stream requests on a circuit, we want to continue to do so until one of the parties closes the circuit. I've documented this in several comments, in case whe want to get fancier in the future. Closes #1188.
| * proto: Send END when buffer of IncomingRequests is fullNick Mathewson2024-01-171-2/+0
| | | | | | | | Closes #1189.
* | Remove TODO for #1191Nick Mathewson2024-01-171-3/+0
|/ | | | | | The bug described here was already fixed as #1065 via !1681. Closes #1191.
* proto: Convert a TODO HSS to ticket #1191Nick Mathewson2024-01-101-1/+1
|