pub(crate) struct StreamEntry {
gate: Gate,
inbox: Sender<StreamCommand>,
}Expand description
What the registry keeps for one live stream.
Two things, and they are here for two different callers. The Gate is
what a SerializeAfter waits on. The inbox is how a request that
arrives from outside the session reaches the task that owns the
stream’s write half.
The inbox is a channel rather than a shared handle because
SendStream::write_all and SendStream::reset both take &mut self
and the stream is moved by value into its forwarding task on every
path. Sharing it would mean a lock, and that lock would be held across
write_all().await — on the byte-pump fast path, for as long as the
destination’s flow control took. Handing the task a message instead
costs one select! branch and keeps the write where it already is.
Fields§
§gate: GateReleased when the stream ends.
inbox: Sender<StreamCommand>Where a request aimed at this stream is delivered.