pub struct DatagramReceiver { /* private fields */ }Expand description
One session’s inbound HTTP Datagrams, and its claim on a Quarter Stream ID.
Obtained from Stream::datagrams and
held for the life of the session. Dropping it takes the Quarter Stream ID
out of the connection’s routing table, which is what keeps the table from
leaking entries: a session can end through any of half a dozen paths –
refused before it started, idle, reset, its socket broken – and every one of
them drops this.
Datagrams that arrive after the drop are dropped like any other unknown id, which is exactly what RFC 9297 §2.1 permits for a stream that no longer exists.
Implementations§
Source§impl DatagramReceiver
impl DatagramReceiver
Sourcepub async fn recv(&mut self) -> Option<Bytes>
pub async fn recv(&mut self) -> Option<Bytes>
Waits for the next payload routed to this session.
None means the connection’s router will send nothing further, which on
a live connection cannot happen: the sending half lives in the routing
table under this receiver’s own entry, and that entry outlives the
receiver by nothing at all.
Cancel-safe ([tokio::sync::mpsc::Receiver::recv] is), so a session may
poll it inside a select! with a timeout – which is what a UDP session
does with all three of its sources.