Agent now sends session messages on each server reconnect.

Ylian Saint-Hilaire committed Jul 31, 2020 at 12:56 UTC ce4fdd14e3ae6f7da3a2900a70ce8ab362512e63
1 file changed +6 -1
agents/meshcore.js
+6 -1
@@ -2393,7 +2393,7 @@ function createMeshCore(agent) {
2393 if (args['_'].length != 1) {
2394 response = "Proper usage: addagentmsg \"Alert Message\""; // Display usage
2395 } else {
2396 - tunnelUserCount.msg[args['_']] = 1;
2396 + tunnelUserCount.msg[args['_'][0]] = 1;
2397 try { mesh.SendCommand({ action: 'sessions', type: 'msg', value: tunnelUserCount.msg }); } catch (ex) { }
2398 }
2399 break;
@@ -3444,6 +3444,11 @@ function createMeshCore(agent) {
3444 meInfoStr = null;
3445 sendPeriodicServerUpdate();
3446 if (selfInfoUpdateTimer == null) { selfInfoUpdateTimer = setInterval(sendPeriodicServerUpdate, 1200000); } // 20 minutes
3447 +
3448 + // Send any state messages
3449 + if (Object.keys(tunnelUserCount.msg).length > 0) {
3450 + try { mesh.SendCommand({ action: 'sessions', type: 'msg', value: tunnelUserCount.msg }); } catch (ex) { }
3451 + }
3452 }
3453 }
3454