| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
|
| |
|
|
|
| |
This will enable us to update the channel's KIST configuration whenever
there is a change in the consensus or config.
|
| | |
|
| |
|
|
|
|
| |
This is unfortunately necessary, because after the channel handshake, we
need to give the channel reactor a `StreamOps` handle to the underlying
stream.
|
| |
|
|
|
|
|
|
| |
Note: this commit makes `tor-proto` depend on `tor-netdir`
(because it adds a `KistParams` type that is buildable from
`NetParameters`, which is defined in `tor-netdir`).
Closes #1729
|
| | |
|
| |
|
|
|
|
| |
This had a TODO about returning a "status indication instead of just ()"
so this commit adds some status indication that we can expand later if
needed.
|
| |
|
|
| |
`Receiver`
|
| |
|
|
|
| |
This is no longer applicable with the new oneshot broadcast channel
design.
|
| |
|
|
|
| |
The old version had some issues, so this is a rewrite which uses
slightly lower level synchronization types (`Mutex` and `OnceLock`).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously `Channel` had two concepts of "closed". There was an atomic
flag that was set to `true` at the end `Reactor::run`, and an
experimental oneshot channel where the sender was dropped when the
reactor was dropped.
This commit consolidates these two using the `oneshot_broadcast` module.
This means that the behaviour is consistent between both "closed"
statuses (`is_closing()` and `wait_for_close()`). A channel is
considered closed when its reactor is dropped.
This also helps progress towards making the channel reactor cancellation
safe (see arti#1756).
|
| |
|
|
| |
This doesn't need to be shared with the reactor.
|
| | |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
| |
Fixes #1682.
(This involves some noise in the tests.)
|
| |
|
|
|
| |
See
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2509#note_3089913
|
| | |
|
| |
|
|
| |
This will save circuits etc. keeping their own clone of the time provider.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
This provides a nice place to change in the tests, when we want to
change the way the queue is made.
|
| |
|
|
|
| |
This gets it as far as the outbound circuit->channel mpsc queue creation.
Also, we provide an accessor for it.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Making a channel is going to involve making a memquota Participant,
which can fail.
|
| |
|
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Make it clear we're discarding `()`, not an actual value.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
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.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|