Skip to content

Commit

Permalink
IO errors e.g. connection close not logged as hard errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Nov 8, 2024
1 parent ead5e56 commit f9087a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion network/rpc_framework/src/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where T: AsyncRead + AsyncWrite + Unpin
Err(RpcHandshakeError::ClientNoSupportedVersion)
},
Ok(Some(Err(err))) => {
error!(target: LOG_TARGET, "Error during handshake: {}", err);
debug!(target: LOG_TARGET, "IO error during handshake: {}", err);
Err(err.into())
},
Ok(None) => {
Expand Down
9 changes: 9 additions & 0 deletions network/rpc_framework/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ where
#[cfg(feature = "metrics")]
metrics::handshake_error_counter(&peer_id, &notification.protocol).inc();
},
Err(err @ RpcServerError::Io(_)) => {
debug!(target: LOG_TARGET, "IO error: {}", err);
#[cfg(feature = "metrics")]
metrics::handshake_error_counter(&peer_id, &notification.protocol).inc();
},
Err(err) => {
debug!(target: LOG_TARGET, "Unable to spawn RPC service: {}", err);
},
Expand Down Expand Up @@ -780,6 +785,10 @@ where TSvc: Service<Request<Bytes>, Response = Response<Body>, Error = RpcStatus
debug!(target: LOG_TARGET, "Stream was interrupted by client: {}", err);
break;
},
RpcServerError::Io(err) => {
debug!(target: LOG_TARGET, "Stream was interrupted by client: IO error: {}", err);
break;
}
err => {
error!(target: LOG_TARGET, "Stream was interrupted: {}", err);
return Err(err);
Expand Down

0 comments on commit f9087a8

Please sign in to comment.