Skip to content

Commit d8cc4d3

Browse files
committed
refactor(quinn): Remove some usage of execute_poll
This commit makes there be fewer places where SendStream::execute_poll is called directly. AsyncWrite implementations now go through poll_write, and poll_write now goes through the write future. This means that execute_poll is now only called directly from write and write_chunks.
1 parent bce3284 commit d8cc4d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

quinn/src/send_stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ impl SendStream {
241241
cx: &mut Context,
242242
buf: &[u8],
243243
) -> Poll<Result<usize, WriteError>> {
244-
self.get_mut().execute_poll(cx, |stream| stream.write(buf))
244+
pin!(self.get_mut().write(buf)).as_mut().poll(cx)
245245
}
246246
}
247247

248248
#[cfg(feature = "futures-io")]
249249
impl futures_io::AsyncWrite for SendStream {
250250
fn poll_write(self: Pin<&mut Self>, cx: &mut Context, buf: &[u8]) -> Poll<io::Result<usize>> {
251-
Self::execute_poll(self.get_mut(), cx, |stream| stream.write(buf)).map_err(Into::into)
251+
self.poll_write(cx, buf).map_err(Into::into)
252252
}
253253

254254
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<io::Result<()>> {
@@ -266,7 +266,7 @@ impl tokio::io::AsyncWrite for SendStream {
266266
cx: &mut Context<'_>,
267267
buf: &[u8],
268268
) -> Poll<io::Result<usize>> {
269-
Self::execute_poll(self.get_mut(), cx, |stream| stream.write(buf)).map_err(Into::into)
269+
self.poll_write(cx, buf).map_err(Into::into)
270270
}
271271

272272
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<io::Result<()>> {

0 commit comments

Comments
 (0)