mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-09 04:38:07 -05:00
Improved fix for #2687
This commit is contained in:
parent
ba7ab1cda4
commit
574bff2518
18
meshrelay.js
18
meshrelay.js
@ -615,6 +615,19 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||||||
closeBothSides();
|
closeBothSides();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Set the session expire timer
|
||||||
|
function setExpireTimer() {
|
||||||
|
if (obj.expireTimer != null) { clearTimeout(obj.expireTimer); delete obj.expireTimer; }
|
||||||
|
if (cookie && (typeof cookie.expire == 'number')) {
|
||||||
|
const timeToExpire = (cookie.expire - currentTime);
|
||||||
|
if (timeToExpire >= 0x7FFFFFFF) {
|
||||||
|
obj.expireTimer = setTimeout(setExpireTimer, 0x7FFFFFFF);
|
||||||
|
} else {
|
||||||
|
obj.expireTimer = setTimeout(closeBothSides, timeToExpire);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close both our side and the peer side.
|
// Close both our side and the peer side.
|
||||||
function closeBothSides() {
|
function closeBothSides() {
|
||||||
if (obj.id != null) {
|
if (obj.id != null) {
|
||||||
@ -770,10 +783,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this session has a expire time, setup the expire timer now.
|
// If this session has a expire time, setup the expire timer now.
|
||||||
if (cookie && (typeof cookie.expire == 'number')) {
|
setExpireTimer();
|
||||||
const timeToExpire = (cookie.expire - currentTime);
|
|
||||||
if (timeToExpire < 0x7FFFFFFF) { obj.expireTimer = setTimeout(closeBothSides, timeToExpire); } // Only set the timeout if it fits in 32bit signed integer.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark this relay session as authenticated if this is the user end.
|
// Mark this relay session as authenticated if this is the user end.
|
||||||
obj.authenticated = (user != null);
|
obj.authenticated = (user != null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user