mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 22:25:52 -05:00
Merge pull request #3428 from nzalev/bugfix-agent-disconnect
Fix null reference on agent disconnect
This commit is contained in:
commit
213f06658c
14
meshagent.js
14
meshagent.js
@ -58,7 +58,19 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
dataAccounting();
|
||||
|
||||
if ((arg == 1) || (arg == null)) { try { ws.close(); if (obj.nodeid != null) { parent.parent.debug('agent', 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Soft close, close the websocket
|
||||
if (arg == 2) { try { ws._socket._parent.end(); if (obj.nodeid != null) { parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Hard close, close the TCP socket
|
||||
if (arg == 2) {
|
||||
try {
|
||||
if (ws._socket._parent != null)
|
||||
ws._socket._parent.end();
|
||||
else
|
||||
ws._socket.end();
|
||||
|
||||
if (obj.nodeid != null) {
|
||||
parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')');
|
||||
}
|
||||
} catch (e) { console.log(e); }
|
||||
}
|
||||
// If arg == 2, hard close, close the TCP socket
|
||||
// If arg == 3, don't communicate with this agent anymore, but don't disconnect (Duplicate agent).
|
||||
|
||||
// Stop any current self-share
|
||||
|
Loading…
Reference in New Issue
Block a user