Skip to content

Commit f2c5e52

Browse files
committed
Flush response buffer only if it's not empty
1 parent 07a1c23 commit f2c5e52

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/webserver/http.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ impl Write for ResponseWriter {
9595
Ok(buf.len())
9696
}
9797
fn flush(&mut self) -> std::io::Result<()> {
98+
if self.buffer.is_empty() {
99+
return Ok(());
100+
}
98101
log::trace!(
99102
"Flushing data to client: {}",
100103
String::from_utf8_lossy(&self.buffer)

0 commit comments

Comments
 (0)