Skip to content

Commit 204c889

Browse files
committed
implement poll_write_vectored
1 parent ff67c4e commit 204c889

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/net/error_capturing_stream.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::pin::Pin;
33
use std::task::{Context, Poll};
44
use std::time::Duration;
55
use tokio::io::{self, AsyncRead, AsyncWrite, ReadBuf};
6+
use std::io::IoSlice;
67

78
use pin_project::pin_project;
89

@@ -95,6 +96,22 @@ impl<T: AsyncRead + AsyncWrite + std::fmt::Debug> AsyncWrite for ErrorCapturingS
9596
}
9697
this.inner.poll_shutdown(cx)
9798
}
99+
100+
fn poll_write_vectored(
101+
self: Pin<&mut Self>,
102+
cx: &mut Context<'_>,
103+
bufs: &[IoSlice<'_>],
104+
) -> Poll<io::Result<usize>> {
105+
let this = self.project();
106+
if *this.is_broken {
107+
return Poll::Ready(Err(io::Error::other("Broken stream")));
108+
}
109+
this.inner.poll_write_vectored(cx, bufs)
110+
}
111+
112+
fn is_write_vectored(&self) -> bool {
113+
self.inner.is_write_vectored()
114+
}
98115
}
99116

100117
impl<T: SessionStream> SessionStream for ErrorCapturingStream<T> {

0 commit comments

Comments
 (0)