Skip to content

Commit

Permalink
fix: re-enable verbose connection read logs (#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar authored Oct 24, 2024
1 parent aba01ff commit d99e90d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,14 +1140,21 @@ mod verbose {
fn poll_read(
mut self: Pin<&mut Self>,
cx: &mut Context,
buf: ReadBufCursor<'_>,
mut buf: ReadBufCursor<'_>,
) -> Poll<std::io::Result<()>> {
match Pin::new(&mut self.inner).poll_read(cx, buf) {
// TODO: This _does_ forget the `init` len, so it could result in
// re-initializing twice. Needs upstream support, perhaps.
// SAFETY: Passing to a ReadBuf will never de-initialize any bytes.
let mut vbuf = hyper::rt::ReadBuf::uninit(unsafe { buf.as_mut() });
match Pin::new(&mut self.inner).poll_read(cx, vbuf.unfilled()) {
Poll::Ready(Ok(())) => {
/*
log::trace!("{:08x} read: {:?}", self.id, Escape(buf.filled()));
*/
log::trace!("TODO: verbose poll_read");
log::trace!("{:08x} read: {:?}", self.id, Escape(vbuf.filled()));
let len = vbuf.filled().len();
// SAFETY: The two cursors were for the same buffer. What was
// filled in one is safe in the other.
unsafe {
buf.advance(len);
}
Poll::Ready(Ok(()))
}
Poll::Ready(Err(e)) => Poll::Ready(Err(e)),
Expand Down

0 comments on commit d99e90d

Please sign in to comment.