mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Terminate connection on timeout
If a connection has timed out the most likely cause is the connection going stale, in which case calling close could take up to 30 seconds before the ws lib gives up on waiting for the close message. Terminate the connection instead on the Node.js side. Note that Firefox does not permit applications from closing connections with a code other than 1000, or in the range 3000-4999.
This commit is contained in:
1 parent
f529457f96
commit
4a72c14b74
3 files changed
+10
-14
No files matched your search
@@ -136,7 +136,7 @@ class WsServer {
|
||||
let timeoutId = setTimeout(() => {
|
||||
logger.verbose(`WsServer | closing ${req.socket.remoteAddress} after timing out on handshake`);
|
||||
wsRejectedConnectionsCounter.inc();
|
||||
socket.close(1008, "Handshake timeout");
|
||||
socket.terminate();
|
||||
this.pendingSockets.delete(socket);
|
||||
}, 30*1000);
|
||||
|
||||
|
||||
Reference in new issue
Block a user