Skip to content

feat: add transmit to UdpPoller::poll_writable #64

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion quinn/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ impl State {
}
};

if self.io_poller.as_mut().poll_writable(cx)?.is_pending() {
if self.io_poller.as_mut().poll_writable(cx, &t)?.is_pending() {
// Retry after a future wakeup
self.buffered_transmit = Some(t);
return Ok(false);
Expand Down
12 changes: 10 additions & 2 deletions quinn/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ pub trait UdpPoller: Send + Sync + Debug + 'static {
/// register the task associated with `cx` to be woken when a send should be attempted
/// again. Unlike in [`Future::poll`], a [`UdpPoller`] may be reused indefinitely no matter how
/// many times `poll_writable` returns [`Poll::Ready`].
fn poll_writable(self: Pin<&mut Self>, cx: &mut Context) -> Poll<io::Result<()>>;
fn poll_writable(
self: Pin<&mut Self>,
cx: &mut Context,
t: &proto::Transmit,
) -> Poll<io::Result<()>>;
}

pin_project_lite::pin_project! {
Expand Down Expand Up @@ -133,7 +137,11 @@ where
MakeFut: Fn() -> Fut + Send + Sync + 'static,
Fut: Future<Output = io::Result<()>> + Send + Sync + 'static,
{
fn poll_writable(self: Pin<&mut Self>, cx: &mut Context) -> Poll<io::Result<()>> {
fn poll_writable(
self: Pin<&mut Self>,
cx: &mut Context,
_t: &proto::Transmit,
) -> Poll<io::Result<()>> {
let mut this = self.project();
if this.fut.is_none() {
this.fut.set(Some((this.make_fut)()));
Expand Down
Loading