Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Add ResetWithoutClosingHandshake to handled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvschoor committed Jul 2, 2022
1 parent 02b5f05 commit b0a7853
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/handler/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::io::ErrorKind::{ConnectionAborted, ConnectionReset, TimedOut, WouldBloc
use std::io::Write;
use tokio::net::TcpStream;
use tokio::time::timeout;
use tokio_tungstenite::tungstenite::error::ProtocolError::ResetWithoutClosingHandshake;
use tokio_tungstenite::tungstenite::Error;
use tokio_tungstenite::WebSocketStream;

Expand Down Expand Up @@ -165,6 +166,13 @@ impl Player {
);
return Err(anyhow::Error::new(e));
}
Err(Error::Protocol(e)) if e == ResetWithoutClosingHandshake => {
warn!(
"Client stopped responding\nAddress:{:?}\nPlayerId:{:?}\nName:{:?}\nError: {:?}",
self.client_ws.peer_addr(), self.player_id, self.data.name,e
);
return Err(anyhow::Error::new(e));
}
Err(err) => panic!(
"Could not receive: Address:{:?}\nPlayerId:{:?}\nName:{:?}\nError:{:?}",
self.client_ws.peer_addr(),
Expand Down

0 comments on commit b0a7853

Please sign in to comment.