refactor(http): adjust debug logs

This commit is contained in:
Sean McArthur
2017-01-23 22:48:09 -08:00
parent 8cd89bed86
commit 8597c55a13
3 changed files with 16 additions and 8 deletions

View File

@@ -97,6 +97,7 @@ impl<I: Io, T: Http1Transaction, K: KeepAlive> Conn<I, T, K> {
other => Err(io::Error::new(io::ErrorKind::UnexpectedEof, other)),
}
} else {
debug!("socket read eof");
Ok(Async::Ready(None))
}
};

View File

@@ -59,7 +59,8 @@ impl Encoder {
}
*remaining -= n as u64;
trace!("sized write complete, remaining = {}", remaining);
debug!("encoded {} bytes", n);
trace!("encode sized complete, remaining = {}", remaining);
Ok(n)
},
}

View File

@@ -126,13 +126,18 @@ impl<T: Write> Write for Buffered<T> {
}
fn flush(&mut self) -> io::Result<()> {
self.write_buf.write_into(&mut self.io).and_then(|_n| {
if self.write_buf.remaining() == 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::WouldBlock, "wouldblock"))
}
})
if self.write_buf.remaining() == 0 {
Ok(())
} else {
self.write_buf.write_into(&mut self.io).and_then(|n| {
debug!("flushed {} bytes", n);
if self.write_buf.remaining() == 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::WouldBlock, "wouldblock"))
}
})
}
}
}
@@ -290,6 +295,7 @@ impl WriteBuf {
trace!("WriteBuf reserving initial {}", init);
vec.reserve(init);
} else if cap < MAX_BUFFER_SIZE {
trace!("maybe_reserve MAX={}, needed={}, cap={}", MAX_BUFFER_SIZE, needed, cap);
vec.reserve(cmp::min(needed, MAX_BUFFER_SIZE - cap));
trace!("WriteBuf reserved {}", vec.capacity() - cap);
}