Fixed possible server exceptions.

Ylian Saint-Hilaire committed Jan 26, 2021 at 00:09 UTC eb4c7995dae529265303d11085ad838e027d5500
2 files changed +7 -2
meshagent.js
+6 -1
@@ -1671,7 +1671,12 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1671 if ((tag != null) && (tag.length == 0)) { tag = null; }
1672
1673 // If the device is pending a change, hold.
1674 - if (obj.deviceChanging === true) { setTimeout(function () { ChangeAgentCoreInfo(command); }, 100); return; }
1674 + if (obj.deviceChanging === true) {
1675 + var func = function ChangeAgentTagFunc() { ChangeAgentCoreInfo(ChangeAgentTagFunc.cmd); }
1676 + func.cmd = command;
1677 + setTimeout(func, 100);
1678 + return;
1679 + }
1680 obj.deviceChanging = true;
1681
1682 // Get the node and change it if needed
webserver.js
+1 -1
@@ -3659,7 +3659,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3659 // Log to recording file
3660 if (ws.logfile == null) {
3661 // Forward data to the associated TCP connection.
3662 - ws.forwardclient.write(data);
3662 + try { ws.forwardclient.write(data); } catch (ex) { }
3663 } else {
3664 // Log to recording file
3665 recordingEntry(ws.logfile.fd, 2, 2, data, function () { try { ws.forwardclient.write(data); } catch (ex) { } });