Skip to content

Commit 9304876

Browse files
committed
Add a message for EOF-related broken pipe errors
It's quite confusing from production logs when all I get is "broken pipe" and I don't know which path was taken for that error to be logged.
1 parent 3a0c622 commit 9304876

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/proto/streams/state.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ impl State {
303303
Closed(..) => {}
304304
ref state => {
305305
tracing::trace!("recv_eof; state={:?}", state);
306-
self.inner = Closed(Cause::Error(io::ErrorKind::BrokenPipe.into()));
306+
self.inner = Closed(Cause::Error(io::Error::new(
307+
io::ErrorKind::BrokenPipe,
308+
"stream closed because of broken pipe",
309+
).into()));
307310
}
308311
}
309312
}

src/proto/streams/streams.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,13 @@ impl Inner {
807807
let send_buffer = &mut *send_buffer;
808808

809809
if actions.conn_error.is_none() {
810-
actions.conn_error = Some(io::Error::from(io::ErrorKind::BrokenPipe).into());
810+
actions.conn_error = Some(
811+
io::Error::new(
812+
io::ErrorKind::BrokenPipe,
813+
"connection closed because of broken pipe",
814+
)
815+
.into(),
816+
);
811817
}
812818

813819
tracing::trace!("Streams::recv_eof");

0 commit comments

Comments
 (0)