Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Sep 10, 2024
1 parent 69358cc commit e59fb1d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ntex-glommio/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct Write(TcpStream);
impl ntex_io::AsyncWrite for Write {
#[inline]
async fn write(&mut self, mut buf: BytesVec) -> (BytesVec, io::Result<()>) {
match lazy(|cx| flush_io(&mut *self.0.0.borrow_mut(), &mut buf, cx)).await {
match lazy(|cx| flush_io(&mut *self.0 .0.borrow_mut(), &mut buf, cx)).await {
Poll::Ready(res) => (buf, res),
Poll::Pending => (buf, Ok(())),
}
Expand All @@ -74,7 +74,7 @@ impl ntex_io::AsyncWrite for Write {

#[inline]
async fn shutdown(&mut self) -> io::Result<()> {
poll_fn(|cx| Pin::new(&mut *self.0.0.borrow_mut()).poll_close(cx)).await
poll_fn(|cx| Pin::new(&mut *self.0 .0.borrow_mut()).poll_close(cx)).await
}
}

Expand Down Expand Up @@ -123,7 +123,7 @@ pub(super) fn flush_io<T: AsyncRead + AsyncWrite + Unpin>(
// log::trace!("flushed {} bytes", written);

// flush
return if written > 0 {
if written > 0 {
match Pin::new(&mut *io).poll_flush(cx) {
Poll::Ready(Ok(_)) => result,
Poll::Pending => Poll::Pending,
Expand All @@ -134,7 +134,7 @@ pub(super) fn flush_io<T: AsyncRead + AsyncWrite + Unpin>(
}
} else {
result
};
}
} else {
Poll::Ready(Ok(()))
}
Expand Down Expand Up @@ -176,7 +176,7 @@ struct UnixWrite(UnixStream);
impl ntex_io::AsyncWrite for UnixWrite {
#[inline]
async fn write(&mut self, mut buf: BytesVec) -> (BytesVec, io::Result<()>) {
match lazy(|cx| flush_io(&mut *self.0.0.borrow_mut(), &mut buf, cx)).await {
match lazy(|cx| flush_io(&mut *self.0 .0.borrow_mut(), &mut buf, cx)).await {
Poll::Ready(res) => (buf, res),
Poll::Pending => (buf, Ok(())),
}
Expand All @@ -189,6 +189,6 @@ impl ntex_io::AsyncWrite for UnixWrite {

#[inline]
async fn shutdown(&mut self) -> io::Result<()> {
poll_fn(|cx| Pin::new(&mut *self.0.0.borrow_mut()).poll_close(cx)).await
poll_fn(|cx| Pin::new(&mut *self.0 .0.borrow_mut()).poll_close(cx)).await
}
}

0 comments on commit e59fb1d

Please sign in to comment.