Unverified Commit 3b4829d7 authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

ws-server: Handle `soketto::Incoming::Closed` frames (#815)



* ws-server: Handle `soketto::Incoming::Closed` frames

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>

* ws-server: Change `warn` -> `debug` for dropped connections

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>

* ws-server: Remove closed reason log

Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>

* Update ws-server/src/server.rs

Co-authored-by: Niklas Adolfsson's avatarNiklas Adolfsson <niklasadolfsson1@gmail.com>
parent 3ee635ff
Pipeline #201729 passed with stages
in 4 minutes and 43 seconds
......@@ -436,7 +436,11 @@ async fn background_task<M: Middleware>(input: BackgroundTask<'_, M>) -> Result<
match receiver.receive(&mut data).await? {
soketto::Incoming::Data(d) => break Ok(d),
soketto::Incoming::Pong(_) => tracing::debug!("recv pong"),
_ => continue,
soketto::Incoming::Closed(_) => {
// The closing reason is already logged by `soketto` trace log level.
// Return the `Closed` error to avoid logging unnecessary warnings on clean shutdown.
break Err(SokettoError::Closed);
}
}
}
};
......@@ -461,7 +465,7 @@ async fn background_task<M: Middleware>(input: BackgroundTask<'_, M>) -> Result<
}
// These errors can not be gracefully handled, so just log them and terminate the connection.
MonitoredError::Selector(err) => {
tracing::warn!("WS error: {}; terminate connection {}", err, conn_id);
tracing::debug!("WS error: {}; terminate connection {}", err, conn_id);
sink.close();
break Err(err.into());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment