Skip to main content

benign_close

Function benign_close 

Source
pub fn benign_close(error: &ConnectionError) -> Option<BenignClose>
Expand description

Classifies a connection-level error that is an ordinary goodbye rather than a failure, or None if it deserves a warning.

The judgement is made on the error value on purpose. The obvious alternative — asking quinn::Connection::close_reason() afterwards — cannot work: dropping the HTTP/3 connection closes the QUIC connection with H3_NO_ERROR, and quinn’s close path unconditionally overwrites whatever reason was stored with LocallyClosed. By the time a caller could ask, the real reason is gone. An error value, by contrast, is immutable and independent of drop order.