Log close reason on disconnect

v5-api
Dominik Nakamura 2 years ago
parent 29ee3cf136
commit fd5d52405d
No known key found for this signature in database
GPG Key ID: E4C6A749B2491910

@ -215,9 +215,11 @@ impl Client {
let handle = tokio::spawn(async move {
while let Some(Ok(msg)) = read.next().await {
trace!("{}", msg);
if let Message::Close(info) = &msg {
if let Some(CloseFrame { reason, .. }) = info {
info!(%reason, "connection closed with reason");
}
if msg.is_close() {
#[cfg(feature = "events")]
events_tx.send(Event::ServerStopping).ok();
continue;

Loading…
Cancel
Save