quinn icon indicating copy to clipboard operation
quinn copied to clipboard

Await connection drain

Open BiagioFesta opened this issue 2 years ago • 3 comments

I am wondering if it mighty worth it to have a future to await the draining of the connection (if such possibility does not exist yet).

The scenario is the following:

async fn main() {
   // ...
   connection.close(VarInt::from_u32(0), b"bye");
}

The CLOSE frame might not be sent if program terminates before driver flushes egress.

On top of my head, I was thinking something like:

connection.close(...);
connection.drained().await;  // Awaits flush egress

Feel free to close this issue in case, it is just a very minor concern :)

BiagioFesta avatar Sep 16 '23 12:09 BiagioFesta