From 832cc674361b08abe272772972a66a0bac653b84 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sat, 2 May 2020 00:22:54 -0700 Subject: [PATCH] Added session recording debug. --- meshdesktopmultiplex.js | 7 ++++++- meshrelay.js | 2 ++ package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/meshdesktopmultiplex.js b/meshdesktopmultiplex.js index 3aec1b5d..4d763f4e 100644 --- a/meshdesktopmultiplex.js +++ b/meshdesktopmultiplex.js @@ -640,8 +640,13 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) { recFullFilename = parent.parent.path.join(parent.parent.recordpath, recFilename); } parent.parent.fs.open(recFullFilename, 'w', function (err, fd) { - if (err != null) { func(false); return; } + if (err != null) { + parent.parent.debug('relay', 'Relay: Unable to record to file: ' + recFullFilename); + func(false); + return; + } // Write the recording file header + parent.parent.debug('relay', 'Relay: Started recoding to file: ' + recFullFilename); var metadata = { magic: 'MeshCentralRelaySession', ver: 1, nodeid: obj.nodeid, time: new Date().toLocaleString(), protocol: 2 }; var firstBlock = JSON.stringify(metadata); recordingEntry(fd, 1, 0, firstBlock, function () { diff --git a/meshrelay.js b/meshrelay.js index 15d76d9a..65f9a81a 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -241,10 +241,12 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie parent.parent.fs.open(recFullFilename, 'w', function (err, fd) { if (err != null) { // Unable to record + parent.parent.debug('relay', 'Relay: Unable to record to file: ' + recFullFilename); try { ws.send('c'); } catch (ex) { } // Send connect to both peers try { relayinfo.peer1.ws.send('c'); } catch (ex) { } } else { // Write the recording file header + parent.parent.debug('relay', 'Relay: Started recoding to file: ' + recFullFilename); var metadata = { magic: 'MeshCentralRelaySession', ver: 1, userid: sessionUser._id, username: sessionUser.name, sessionid: obj.id, ipaddr1: cleanRemoteAddr(obj.req.ip), ipaddr2: cleanRemoteAddr(obj.peer.req.ip), time: new Date().toLocaleString(), protocol: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p), nodeid: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.nodeid ) }; if (xdevicename2 != null) { metadata.devicename = xdevicename2; } var firstBlock = JSON.stringify(metadata); diff --git a/package.json b/package.json index 08f6b3ba..9baf3f86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.5.19", + "version": "0.5.20", "keywords": [ "Remote Management", "Intel AMT",