1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

More lastconnect improvements, added meshid.

This commit is contained in:
Ylian Saint-Hilaire 2021-08-03 19:28:48 -07:00
parent 880be2b41b
commit a45febe864
2 changed files with 10 additions and 5 deletions

View file

@ -2139,7 +2139,7 @@ function CreateMeshCentralServer(config, args) {
obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: state.connectivity, pwr: state.powerState, ct: connectTime, nolog: 1, nopeers: 1 });
// Save indication of node connection change
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], time: Date.now(), cause: 1, connectType: connectType, serverid: obj.serverId };
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], meshid: meshid, time: Date.now(), cause: 1, connectType: connectType, serverid: obj.serverId };
if (extraInfo && extraInfo.remoteaddrport) { lc.addr = extraInfo.remoteaddrport; }
obj.db.Set(lc);
}
@ -2182,7 +2182,7 @@ function CreateMeshCentralServer(config, args) {
// Save indication of node connection change
if (serverid == obj.serverId) {
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], time: Date.now(), cause: 1, connectType: connectType, serverid: obj.serverId };
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], meshid: meshid, time: Date.now(), cause: 1, connectType: connectType, serverid: obj.serverId };
if (extraInfo && extraInfo.remoteaddrport) { lc.addr = extraInfo.remoteaddrport; }
obj.db.Set(lc);
}
@ -2210,7 +2210,7 @@ function CreateMeshCentralServer(config, args) {
state.connectivity -= connectType;
// Save indication of node connection change
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], time: Date.now(), cause: 0, connectType: connectType, serverid: obj.serverId };
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], meshid: meshid, time: Date.now(), cause: 0, connectType: connectType, serverid: obj.serverId };
if (extraInfo && extraInfo.remoteaddrport) { lc.addr = extraInfo.remoteaddrport; }
obj.db.Set(lc);
@ -2250,7 +2250,7 @@ function CreateMeshCentralServer(config, args) {
// Save indication of node connection change
if (serverid == obj.serverId) {
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], time: Date.now(), cause: 0, connectType: connectType, serverid: obj.serverId };
const lc = { _id: 'lc' + nodeid, type: 'lastconnect', domain: nodeid.split('/')[1], meshid: meshid, time: Date.now(), cause: 0, connectType: connectType, serverid: obj.serverId };
if (extraInfo && extraInfo.remoteaddrport) { lc.addr = extraInfo.remoteaddrport; }
obj.db.Set(lc);
}