mirror of
https://github.com/openharmony/third_party_rust_h2.git
synced 2026-06-30 21:47:55 -04:00
Add a message for EOF-related broken pipe errors (#615)
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.
This commit is contained in:
@@ -303,7 +303,13 @@ impl State {
|
||||
Closed(..) => {}
|
||||
ref state => {
|
||||
tracing::trace!("recv_eof; state={:?}", state);
|
||||
self.inner = Closed(Cause::Error(io::ErrorKind::BrokenPipe.into()));
|
||||
self.inner = Closed(Cause::Error(
|
||||
io::Error::new(
|
||||
io::ErrorKind::BrokenPipe,
|
||||
"stream closed because of a broken pipe",
|
||||
)
|
||||
.into(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -806,7 +806,13 @@ impl Inner {
|
||||
let send_buffer = &mut *send_buffer;
|
||||
|
||||
if actions.conn_error.is_none() {
|
||||
actions.conn_error = Some(io::Error::from(io::ErrorKind::BrokenPipe).into());
|
||||
actions.conn_error = Some(
|
||||
io::Error::new(
|
||||
io::ErrorKind::BrokenPipe,
|
||||
"connection closed because of a broken pipe",
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
tracing::trace!("Streams::recv_eof");
|
||||
|
||||
@@ -574,7 +574,7 @@ async fn connection_close_notifies_response_future() {
|
||||
.0
|
||||
.await;
|
||||
let err = res.expect_err("response");
|
||||
assert_eq!(err.to_string(), "broken pipe");
|
||||
assert_eq!(err.to_string(), "stream closed because of a broken pipe");
|
||||
};
|
||||
join(async move { conn.await.expect("conn") }, req).await;
|
||||
};
|
||||
@@ -613,7 +613,7 @@ async fn connection_close_notifies_client_poll_ready() {
|
||||
.0
|
||||
.await;
|
||||
let err = res.expect_err("response");
|
||||
assert_eq!(err.to_string(), "broken pipe");
|
||||
assert_eq!(err.to_string(), "stream closed because of a broken pipe");
|
||||
};
|
||||
|
||||
conn.drive(req).await;
|
||||
@@ -621,7 +621,10 @@ async fn connection_close_notifies_client_poll_ready() {
|
||||
let err = poll_fn(move |cx| client.poll_ready(cx))
|
||||
.await
|
||||
.expect_err("poll_ready");
|
||||
assert_eq!(err.to_string(), "broken pipe");
|
||||
assert_eq!(
|
||||
err.to_string(),
|
||||
"connection closed because of a broken pipe"
|
||||
);
|
||||
};
|
||||
|
||||
join(srv, client).await;
|
||||
|
||||
Reference in New Issue
Block a user