Skip to content

Commit 668349d

Browse files
committed
fix usage of ReadBuf in tokio AsyncRead impls
1 parent c05dee5 commit 668349d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

async-ssh2-lite/src/channel.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,20 @@ mod impl_tokio {
338338
let sess = this.sess.clone();
339339
let inner = &mut this.inner;
340340

341-
this.stream
342-
.poll_read_with(cx, || inner.read(buf.filled_mut()).map(|_| {}), &sess)
341+
this.stream.poll_read_with(
342+
cx,
343+
|| {
344+
let size = inner.read(buf.initialize_unfilled());
345+
match size {
346+
Ok(size) => {
347+
buf.advance(size);
348+
Ok(())
349+
}
350+
Err(e) => Err(e),
351+
}
352+
},
353+
&sess,
354+
)
343355
}
344356
}
345357

0 commit comments

Comments
 (0)