| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
| |
I seem to have mistyped this ticket number. We meant #1397
aka "Circuit reactor isn't great", not some release ticket.
|
| |\
| |
| |
| |
| | |
RFC: Provide and use SometimesUnboundedSender in circuit reactor
See merge request tpo/core/arti!2172
|
| | | |
|
| |\|
| |
| |
| |
| | |
Tidy up the ChannelSender::poll_ready inherent method
See merge request tpo/core/arti!2171
|
| | |
| |
| |
| | |
This is where it belongs.
|
| | |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
No actual bug here, just technical debt:
For `SendWindow`s, our tag system already ensured that we rejected
any SENDME that didn't correspond to an appropriate drain. Still,
it doesn't hurt to check.
For `RecvWindow`s, it would have been a protocol violation if we
ever did this, but it makes sense to make it an internal error if we
try.
Part of #1383.
|
| | |
|
| |
|
|
|
| |
It was a bit misleading since it doesn't cover all processing for the
hop.
|
| |
|
|
|
|
|
| |
Get rid of an `if` block by changing the guarded loop to check its
conditions at the beginning of the loop instead of the end. This
is a slight behavior change, since previously channel readiness
wasn't checked before the first iteration of the loop.
|
| |
|
|
|
|
| |
This should be a pure refactor. We remove a large if block and
modify the first loop inside it to check whether the channel is ready
before each attempt to send a message instead of after.
|
| |
|
|
|
|
|
|
| |
There are some tricky bits here that implicitly assume particular
behavior in other bits for correctness. Document these requirements and
assumptions.
Fixes arti#1373
|
| | |
|
| | |
|
| |
|
|
| |
This is always Send+Sync, and invariant with P.
|
| |
|
|
|
| |
(We're letting the "unchecked" suffix of this function be enough
to indicate that it's risky to use.)
|
| |
|
|
|
|
|
|
|
|
| |
Instead of making `streammap.rs` responsible for keeping track of a
count field, this lowers that functionality into a lower-level
CountedHashMap type. Said type has a little more functionality than
we need, to sketch out how we'd want to develop it moving forward if
we find that it's useful elsewhere.
Closes #1344.
|
| | |
|
| |
|
|
|
|
|
|
| |
With this patch, it holds only a reference to `&reactor.hops`,
which greatly simplifies the reactor code's fight with the
borrow checker.
I've left some TODO comments about future directions here.
|
| |
|
|
| |
(Doing this to prevent us having two structs with the same name.)
|
| |
|
|
|
|
|
| |
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'll use this as an argument for the callback that checks stream
requests to make sure they're permitted.
|
| | |
|
| |
|
|
|
|
| |
We want to keep an accurate count of the number of open streams, so
we have to stop exposing `&mut StreamEnt` outside of the streammap
module.
|
| |
|
|
|
|
|
| |
This is the first part of a refactoring that will let us keep code
from the outside of `streammap` from changing a stream from one
state to another. And we need to do _that_ so that StreamMap can
count how many open streams it has.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
For consistency with the terminology proposed in
https://gitlab.torproject.org/tpo/core/torspec/-/issues/253
|
| |
|
|
|
|
|
|
| |
Some of the `tor_circmgr::Error` variants will include the `UniqId` of the
corresponding circuit, so we'll need to be able to display it without the
`Circ ` prefix.
Part of #1297
|
| | |
|
| |
|
|
| |
Closes #1190
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Closes #1189.
|
| | |
|
| |
|
|
|
|
|
| |
These comments are about internal representations and future extensions.
Also, add a fail-safe check to make sure that hop_num consistency is
enforced.
|
| | |
|
| | |
|