Skip to content

Commit

Permalink
Reduce diff
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Oct 6, 2023
1 parent 2cab6b4 commit 166f8ff
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions yamux/src/frame/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use super::{
use crate::connection::Id;
use crate::frame::header::Data;
use futures::{prelude::*, ready};
use std::ops::AddAssign;
use std::{
fmt, io, mem,
pin::Pin,
Expand Down Expand Up @@ -192,14 +191,13 @@ impl<T: AsyncRead + AsyncWrite + Unpin> Stream for Io<T> {
return Poll::Ready(Some(Ok(frame.into_generic_frame())));
}

match ready!(
Pin::new(&mut this.io).poll_read(cx, &mut frame.body_mut()[*offset..])
)? {
let buf = &mut frame.body_mut()[*offset..];
match ready!(Pin::new(&mut this.io).poll_read(cx, buf))? {
0 => {
let e = FrameDecodeError::Io(io::ErrorKind::UnexpectedEof.into());
return Poll::Ready(Some(Err(e)));
}
n => offset.add_assign(n),
n => *offset += n,
}
}
}
Expand Down

0 comments on commit 166f8ff

Please sign in to comment.