Skip to main content

propagate_stop

Function propagate_stop 

Source
fn propagate_stop(
    err: &ProxyError,
    recv: &mut PeekedRecv,
    st: &mut StreamState<'_>,
    side: ProxySide,
    ctx: &ForwardCtx,
    report: &Reporter<'_>,
)
Expand description

Mirror a destination-side write failure onto the source stream.

If the destination peer sent STOP_SENDING, the source stream must be stopped with the same application code. Letting the RecvStream drop instead emits STOP_SENDING with a hard-coded 0 — quinn’s RecvStream::drop calls stop(0) — silently replacing the peer’s reason with “unspecified”. Any other write failure is left to the default teardown.

Two triggers reach here, and they are not interchangeable. The first is a failed write: every inline send.write_all and the deferred release branch route their error through this function. That trigger alone leaves a source that has gone quiet unstopped indefinitely, because nothing writes to notice. The second is StopWatcher, a select! branch over SendStream::stopped() that races the read, so an idle stream learns about the peer’s decision when the peer makes it rather than when the proxy next produces.

Nothing queued can be delivered once the destination has stopped us, so the queue is reported and cleared rather than drained.