fix socket cleanup timeout system
This commit is contained in:
@@ -1313,7 +1313,10 @@ async function cleanupSocket(socket) {
|
|||||||
// set timer to destroy entirety of session data if client does not return in X time
|
// set timer to destroy entirety of session data if client does not return in X time
|
||||||
var timeout = 180000; // timeout is in milliseconds, default 180000 (3 min) .. be sure to allow time for dialup reconnections
|
var timeout = 180000; // timeout is in milliseconds, default 180000 (3 min) .. be sure to allow time for dialup reconnections
|
||||||
|
|
||||||
if (!ssid_sessions[socket.ssid].data_store.socket_check) {
|
// clear any existing timeout check
|
||||||
|
if (ssid_sessions[socket.ssid].data_store.socket_check) clearTimeout(ssid_sessions[socket.ssid].data_store.socket_check);
|
||||||
|
|
||||||
|
// set timeout to check
|
||||||
ssid_sessions[socket.ssid].data_store.socket_check = setTimeout(function (ssid) {
|
ssid_sessions[socket.ssid].data_store.socket_check = setTimeout(function (ssid) {
|
||||||
if (ssid_sessions[ssid].currentConnections() === 0) {
|
if (ssid_sessions[ssid].currentConnections() === 0) {
|
||||||
if (!zquiet) console.log(" * WebTV SSID", filterSSID(ssid), " has not been seen in", (timeout / 1000), "seconds, cleaning up session data for this SSID");
|
if (!zquiet) console.log(" * WebTV SSID", filterSSID(ssid), " has not been seen in", (timeout / 1000), "seconds, cleaning up session data for this SSID");
|
||||||
@@ -1322,7 +1325,6 @@ async function cleanupSocket(socket) {
|
|||||||
}, timeout, socket.ssid);
|
}, timeout, socket.ssid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
socket.end();
|
socket.end();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(" # Could not clean up socket data for socket ID", socket.id, e);
|
console.error(" # Could not clean up socket data for socket ID", socket.id, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user