Skip to content

Commit b11a705

Browse files
committed
record log when a connection is dropped because of a heartbeat timeout
1 parent 2a1f8fa commit b11a705

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/server.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ impl Server {
116116
}
117117

118118
async fn handle_connection(&self, stream: TcpStream) -> Result<()> {
119+
let peer_addr = stream.peer_addr().unwrap().to_string();
119120
let mut stream = Delimited::new(stream);
120121
if let Some(auth) = &self.auth {
121122
if let Err(err) = auth.server_handshake(&mut stream).await {
@@ -146,6 +147,7 @@ impl Server {
146147
loop {
147148
if stream.send(ServerMessage::Heartbeat).await.is_err() {
148149
// Assume that the TCP connection has been dropped.
150+
info!(peer_addr, "connection dropped after heartbeat timeout");
149151
return Ok(());
150152
}
151153
const TIMEOUT: Duration = Duration::from_millis(500);

0 commit comments

Comments
 (0)