Skip to main content

reject

Function reject 

Source
pub(crate) async fn reject<A>(
    conn: &mut FramedConn<A>,
    err: ErrorResponse,
) -> Result<(), Error>
where A: AsyncRead + AsyncWrite + Unpin,
Expand description

Answers the client with a final message and flushes it.

FramedConn::send only enqueues into a buffer, so a rejection that is not flushed reaches the client as a bare socket close rather than the error it was given. Every path that answers the client and then stops has to flush, because the connection is dropped as soon as it returns.