Server exception fixes.

Ylian Saint-Hilaire committed Jan 24, 2021 at 18:11 UTC 93e3f100067809044b21d539bf1fd62a449031ff
2 files changed +3 -2
meshagent.js
+2 -1
@@ -245,7 +245,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
245 // Send the recovery core to the agent, if the agent is capable of running one
246 if (((obj.agentInfo.capabilities & 16) != 0) && (parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].core != null)) {
247 obj.agentCoreUpdate = true;
248 - obj.sendBinary(common.ShortToStr(11) + common.ShortToStr(0));
248 + obj.sendBinary(common.ShortToStr(10) + common.ShortToStr(0)); // Ask to clear the core
249 + obj.sendBinary(common.ShortToStr(11) + common.ShortToStr(0)); // Ask for meshcore hash
250 }
251 } else if (agentUpdateMethod === 1) { // Use native agent update system
252 // Mesh agent update required, do it using task limiter so not to flood the network. Medium priority task.
mpsserver.js
+1 -1
@@ -616,7 +616,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
616 } else {
617 // Node is not in the database, add it. Credentials will be empty until added by the user.
618 var device = { type: 'node', mtype: 1, _id: socket.tag.nodeid, meshid: socket.tag.meshid, name: socket.tag.name, icon: (socket.tag.meiState && socket.tag.meiState.isBatteryPowered) ? 2 : 1, host: socket.remoteAddr, domain: mesh.domain, intelamt: { user: ((socket.tag.meiState) && (typeof socket.tag.meiState.amtuser == 'string')) ? socket.tag.meiState.amtuser : '', pass: ((socket.tag.meiState) && (typeof socket.tag.meiState.amtpass == 'string')) ? socket.tag.meiState.amtpass : '', tls: 0, state: 2 } };
619 - if ((typeof socket.tag.meiState.desc == 'string') && (socket.tag.meiState.desc.length > 0) && (socket.tag.meiState.desc.length < 1024)) { device.desc = socket.tag.meiState.desc; }
619 + if ((socket.tag.meiState != null) && (typeof socket.tag.meiState.desc == 'string') && (socket.tag.meiState.desc.length > 0) && (socket.tag.meiState.desc.length < 1024)) { device.desc = socket.tag.meiState.desc; }
620 obj.db.Set(device);
621
622 // Event the new node