close on done
This commit is contained in:
parent
0928a24ec1
commit
9f138eba7e
@ -33,10 +33,11 @@ impl Stream for Forward {
|
|||||||
type Item = smol::io::Result<Vec<u8>>;
|
type Item = smol::io::Result<Vec<u8>>;
|
||||||
|
|
||||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||||
let this = self.project();
|
let mut this = self.project();
|
||||||
let mut buf = [0; 65536];
|
let mut buf = [0; 65536];
|
||||||
let read = ready!(this.stream.poll_read(cx, &mut buf))?;
|
let read = ready!(this.stream.as_mut().poll_read(cx, &mut buf))?;
|
||||||
if read == 0 {
|
if read == 0 {
|
||||||
|
ready!(this.stream.poll_close(cx))?;
|
||||||
Poll::Ready(None)
|
Poll::Ready(None)
|
||||||
} else {
|
} else {
|
||||||
Poll::Ready(Some(Ok(buf[..read].into())))
|
Poll::Ready(Some(Ok(buf[..read].into())))
|
||||||
|
Loading…
Reference in New Issue
Block a user