quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Accept's Future Output #1676

Closed jxs closed 11 months ago

jxs commented 11 months ago

Accept's Future Output is Option<Connecting>, yielding None when the endpoint is closed.

None can be returned in two situations:

When an Endpoint is created it spawns the EndpointDriver which its futures "terminate when all clones of the Endpoint have been dropped, or when an I/O error occurs".

In both this situations EndpointDriver sets Endpoint's driver_lost to true, which if I understand correctly doesn't allow distinguishing betwen a graceful and an abrupt connection right?

If so can we introduce a mechanism to distinguish both situations and then allow Accept's Future to be Option<Result<Connection>> to also let the end user acknowledge when the Endpoint was properly closed to when was not?

I can to submit a PR addressing this if accepted.

Thanks

Ralith commented 11 months ago

Did you see Connection::close_reason?

Ralith commented 11 months ago

Oh, sorry, you're looking at Endpoint::accept, not Connection::accept_*. That will only return None if you call Endpoint::close yourself. Any other behavior is a serious Quinn (or async runtime, or OS) bug.

jxs commented 11 months ago

ok, thanks for clarifying!