Removed debug code.
Ylian Saint-Hilaire committed
May 10, 2022 at 20:30 UTC
e4d56a7fd07de1922a2d5448c6fe3a49a26f816e
1 file changed
+7
-10
meshuser.js
+7
-10
@@ -121,7 +121,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
121
}
122
123
// Send data through the websocket
124
- obj.send = function (object) { try { ws.send(JSON.stringify(object)); } catch(e) {} }
124
+ obj.send = function (object) { try { ws.send(JSON.stringify(object)); } catch(ex) {} }
125
126
// Clean a IPv6 address that encodes a IPv4 address
127
function cleanRemoteAddr(addr) { if (addr.startsWith('::ffff:')) { return addr.substring(7); } else { return addr; } }
@@ -138,8 +138,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
138
obj.close = function (arg) {
139
obj.ws.xclosed = 1; // This is for testing. Will be displayed when running "usersessions" server console command.
140
141
- if ((arg == 1) || (arg == null)) { try { obj.ws.close(); parent.parent.debug('user', 'Soft disconnect'); } catch (e) { console.log(e); } } // Soft close, close the websocket
142
- if (arg == 2) { try { obj.ws._socket._parent.end(); parent.parent.debug('user', 'Hard disconnect'); } catch (e) { console.log(e); } } // Hard close, close the TCP socket
141
+ if ((arg == 1) || (arg == null)) { try { obj.ws.close(); parent.parent.debug('user', 'Soft disconnect'); } catch (ex) { console.log(ex); } } // Soft close, close the websocket
142
+ if (arg == 2) { try { obj.ws._socket._parent.end(); parent.parent.debug('user', 'Hard disconnect'); } catch (ex) { console.log(ex); } } // Hard close, close the TCP socket
143
144
obj.ws.xclosed = 2; // DEBUG
145
@@ -626,7 +626,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
626
ws._socket.resume();
627
if (parent.parent.pluginHandler != null) parent.parent.pluginHandler.callHook('hook_userLoggedIn', user);
628
});
629
- } catch (e) { console.log(e); }
629
+ } catch (ex) { console.log(ex); }
630
631
// Process incoming web socket data from the browser
632
function processWebSocketData(msg) {
@@ -4273,7 +4273,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
4273
try { ws.send(JSON.stringify({ action: 'pluginError', msg: err })); } catch (er) { }
4274
});
4275
4276
- } catch(e) { console.log('Cannot add plugin: ' + e); }
4276
+ } catch(ex) { console.log('Cannot add plugin: ' + e); }
4277
break;
4278
}
4279
case 'installplugin': {
@@ -4327,7 +4327,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
4327
} else {
4328
try {
4329
parent.parent.pluginHandler.plugins[command.plugin].serveraction(command, obj, parent);
4330
- } catch (e) { console.log('Error loading plugin handler (' + e + ')'); }
4330
+ } catch (ex) { console.log('Error loading plugin handler (' + e + ')'); }
4331
}
4332
break;
4333
}
@@ -6743,10 +6743,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
6743
try { info.uptime = process.uptime(); } catch (ex) { }
6744
try { info.cpuUsage = process.cpuUsage(); } catch (ex) { }
6745
try { info.memoryUsage = process.memoryUsage(); } catch (ex) { }
6746
- try {
6747
- info.warnings = parent.parent.getServerWarnings();
6748
- console.log(info.warnings);
6749
- } catch (ex) { console.log(ex); }
6746
+ try { info.warnings = parent.parent.getServerWarnings(); } catch (ex) { console.log(ex); }
6747
try { info.allDevGroupManagers = parent.parent.config.settings.managealldevicegroups; } catch (ex) { }
6748
try { if (process.traceDeprecation == true) { info.traceDeprecation = true; } } catch (ex) { }
6749
cmdData.result = JSON.stringify(info, null, 4);