From 71dc15e8c9b57300adb812ea4813e13954929e93 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Thu, 4 May 2023 08:22:34 +0200 Subject: [PATCH] ws_protocol: Log when WebSocket is killed by Daphne --- daphne/ws_protocol.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daphne/ws_protocol.py b/daphne/ws_protocol.py index 975b1a9..e8de06f 100755 --- a/daphne/ws_protocol.py +++ b/daphne/ws_protocol.py @@ -279,11 +279,13 @@ class WebSocketProtocol(WebSocketServerProtocol): self.duration() > self.server.websocket_timeout and self.server.websocket_timeout >= 0 ): + logger.warning("WebSocket %s took too long and was killed.", self.client_addr) self.serverClose() # Ping check # If we're still connecting, deny the connection if self.state == self.STATE_CONNECTING: if self.duration() > self.server.websocket_connect_timeout: + logger.warning("WebSocket %s connection took too long and was killed.", self.client_addr) self.serverReject() elif self.state == self.STATE_OPEN: if (time.time() - self.last_ping) > self.server.ping_interval: