quinn-rs / quinn

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

poll send datagram #1738

Closed devsnek closed 5 months ago

devsnek commented 8 months ago

I'd like to wait for free space in the datagram outgoing queue, instead of silently dropping other datagrams. In my mind, send_datagram should return a future you can poll, but that would replace the existing behavior which drops them. Would it be okay to do so? Or would it be better to add a new function like poll_wait_for_datagram_queue_available(len)?

Ralith commented 8 months ago

We had this in the past; see https://github.com/quinn-rs/quinn/pull/555 for discussion. It sounds like both behaviors are desirable in different cases. I'm not opposed to having APIs to support both (especially as tokio::Notify makes multi-waiter APIs much easier than they were in the past), but we shouldn't lose the current functionality.

A few notes to consider: