Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Await connection drain #1665

Open
BiagioFesta opened this issue Sep 16, 2023 · 3 comments
Open

Await connection drain #1665

BiagioFesta opened this issue Sep 16, 2023 · 3 comments

Comments

@BiagioFesta
Copy link
Contributor

BiagioFesta commented Sep 16, 2023

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 :)

@djc
Copy link
Collaborator

djc commented Sep 16, 2023

Call wait_idle() on the Endpoint? Or do you specifically need this for a connection only?

https://github.com/quinn-rs/quinn/blob/main/quinn/src/endpoint.rs#L283C1-L283C1 ?

@BiagioFesta
Copy link
Contributor Author

Nice, I was not aware about that method on Endpoint.

I guess that might perfectly work as well.

Thanks

@BiagioFesta
Copy link
Contributor Author

BiagioFesta commented Sep 16, 2023

Anyway, could it maybe be interesting to have also on Connection as client code might easily drop the endpoint. Or cleanup a single connection from server.

@BiagioFesta BiagioFesta reopened this Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants