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

Added traffic accounting to desktop multiplexor

This commit is contained in:
Ylian Saint-Hilaire 2021-05-05 13:17:58 -07:00
parent f61ab701a5
commit a25ce3c0db
2 changed files with 22 additions and 6 deletions

View file

@ -43,14 +43,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
// Perform data accounting
function dataAccounting() {
const datain = (ws._socket.bytesRead - ws._socket.bytesReadEx);
const dataout = (ws._socket.bytesWritten - ws._socket.bytesWrittenEx);
parent.trafficStats.AgentCtrlIn += (ws._socket.bytesRead - ws._socket.bytesReadEx);
parent.trafficStats.AgentCtrlOut += (ws._socket.bytesWritten - ws._socket.bytesWrittenEx);
ws._socket.bytesReadEx = ws._socket.bytesRead;
ws._socket.bytesWrittenEx = ws._socket.bytesWritten;
// Add to counters
parent.trafficStats.AgentCtrlIn += datain;
parent.trafficStats.AgentCtrlOut += dataout;
}
// Send a message to the mesh agent