mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Timeout quikly when disconnecting existing slave
If a slave that is already connected attempts connecting the existing connection for that slave is disconnected. The most common scenario for this is that the existing connection is stale and the slave is attempting to connect agan. However if the connection is stale then the disconnection will take 15 minutes to time out and the slave will appear unresponsive during this time. Fix this problem by setting the timeout to 15 seconds before disconnecting the existing connection.
This commit is contained in:
1 parent
1b427af5f0
commit
ca2839594e
1 file changed
+1
@@ -1006,6 +1006,7 @@ async function handleHandshake(message, socket, req, attachHandler) {
|
||||
let connection = slaveConnections.get(data.id);
|
||||
if (connection) {
|
||||
console.log(`SOCKET | disconnecting existing connection for slave ${data.id}`);
|
||||
connection.connector.setTimeout(15); // Slave connection is likely stalled
|
||||
await connection.disconnect(1008, "Registered from another connection");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user