Added agent TCP close tracking.

Ylian Saint-Hilaire committed May 28, 2019 at 12:08 UTC dfbaab7c24152c424629a1f38c08859b9651c9de
2 files changed +5 -1
meshagent.js
+4 -1
@@ -477,7 +477,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
477 }
478 obj.close(0);
479 });
480 - // ws._socket._parent.on('close', function (req) { if (obj.nodeid != null) { parent.parent.debug(1, 'Agent TCP disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } });
480 + ws._socket._parent.on('close', function (req) {
481 + parent.agentStats.agentTcpClose++;
482 + //if (obj.nodeid != null) { parent.parent.debug(1, 'Agent TCP disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); }
483 + });
484
485 // Start authenticate the mesh agent by sending a auth nonce & server TLS cert hash.
486 // Send 384 bits SHA384 hash of TLS cert public key + 384 bits nonce
webserver.js
+1
@@ -242,6 +242,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
242 obj.agentStats = {
243 createMeshAgentCount: 0,
244 agentClose: 0,
245 + agentTcpClose: 0,
246 agentBinaryUpdate: 0,
247 coreIsStableCount: 0,
248 verifiedAgentConnectionCount: 0,