Skip to main content

negotiate

Function negotiate 

Source
pub async fn negotiate<R, W>(
    reader: &mut R,
    writer: &mut W,
    budget: &mut Budget,
    readiness: Readiness,
) -> Result<Session, WireError>
where R: AsyncRead + Unpin, W: AsyncWrite + Unpin,
Expand description

Read the first frame and settle the session, or refuse and say why.

On refusal the client is sent a HelloRefusal before the connection closes: a peer that guessed a major version wrong has to be able to tell that from a socket that was never there. The refusal is still returned to the caller, so the connection is closed by the one place that owns closing it.