From 71b18a20848a260cb0a653b3f25f4e40803fbcbb Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 16 Apr 2020 07:45:37 -0700 Subject: [PATCH] Fixed server crash when deleting an active account. --- meshrelay.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshrelay.js b/meshrelay.js index 7d2747b2..332c7b44 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -343,10 +343,10 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie else if (obj.req.query.p == 2) { msg = 'Ended desktop session'; } else if (obj.req.query.p == 5) { msg = 'Ended file management session'; } if (user) { - var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: user._id, username: parent.users[user._id].name, msg: msg + ' \"' + obj.id + '\" from ' + cleanRemoteAddr(obj.peer.req.ip) + ' to ' + cleanRemoteAddr(obj.req.ip) + ', ' + Math.floor((Date.now() - ws.time) / 1000) + ' second(s)', protocol: obj.req.query.p, nodeid: obj.req.query.nodeid }; + var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: user._id, username: user.name, msg: msg + ' \"' + obj.id + '\" from ' + cleanRemoteAddr(obj.peer.req.ip) + ' to ' + cleanRemoteAddr(obj.req.ip) + ', ' + Math.floor((Date.now() - ws.time) / 1000) + ' second(s)', protocol: obj.req.query.p, nodeid: obj.req.query.nodeid }; parent.parent.DispatchEvent(['*', user._id], obj, event); } else if (peer.user) { - var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: peer.user._id, username: parent.users[peer.user._id].name, msg: msg + ' \"' + obj.id + '\" from ' + cleanRemoteAddr(obj.peer.req.ip) + ' to ' + cleanRemoteAddr(obj.req.ip) + ', ' + Math.floor((Date.now() - ws.time) / 1000) + ' second(s)', protocol: obj.req.query.p, nodeid: obj.req.query.nodeid }; + var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: peer.user._id, username: peer.user.name, msg: msg + ' \"' + obj.id + '\" from ' + cleanRemoteAddr(obj.peer.req.ip) + ' to ' + cleanRemoteAddr(obj.req.ip) + ', ' + Math.floor((Date.now() - ws.time) / 1000) + ' second(s)', protocol: obj.req.query.p, nodeid: obj.req.query.nodeid }; parent.parent.DispatchEvent(['*', peer.user._id], obj, event); } }