neoagent 2.3.1-beta.35 → 2.3.1-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"42d3d75a56efe1a2e9902f52dc8006099c45d9
|
|
|
37
37
|
|
|
38
38
|
_flutter.loader.load({
|
|
39
39
|
serviceWorkerSettings: {
|
|
40
|
-
serviceWorkerVersion: "
|
|
40
|
+
serviceWorkerVersion: "3530273712" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -81,15 +81,15 @@ function encodeMessageField(fieldNumber, messageBytes) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
function decodeVarint(buf, offset) {
|
|
84
|
-
let result =
|
|
85
|
-
let shift =
|
|
84
|
+
let result = 0n;
|
|
85
|
+
let shift = 0n;
|
|
86
86
|
let pos = offset;
|
|
87
87
|
while (pos < buf.length) {
|
|
88
|
-
const b = buf[pos++];
|
|
89
|
-
result |= (b &
|
|
90
|
-
if ((b &
|
|
91
|
-
shift +=
|
|
92
|
-
if (shift >
|
|
88
|
+
const b = BigInt(buf[pos++]);
|
|
89
|
+
result |= (b & 0x7Fn) << shift;
|
|
90
|
+
if ((b & 0x80n) === 0n) return { value: Number(result), offset: pos };
|
|
91
|
+
shift += 7n;
|
|
92
|
+
if (shift > 69n) throw new Error('Varint too long');
|
|
93
93
|
}
|
|
94
94
|
throw new Error('Unexpected end of varint');
|
|
95
95
|
}
|
|
@@ -296,6 +296,8 @@ class MeshtasticConnection extends EventEmitter {
|
|
|
296
296
|
this._configured = false;
|
|
297
297
|
this._closing = false;
|
|
298
298
|
this._nodeUsers = new Map();
|
|
299
|
+
// Prevent 'error' events with no listener from crashing the process
|
|
300
|
+
this.on('error', () => {});
|
|
299
301
|
}
|
|
300
302
|
|
|
301
303
|
get myNodeNum() { return this._myNodeNum; }
|
|
@@ -353,12 +355,13 @@ class MeshtasticConnection extends EventEmitter {
|
|
|
353
355
|
const msg = decodeFromRadio(payload);
|
|
354
356
|
this._handleFromRadio(msg);
|
|
355
357
|
} catch (err) {
|
|
356
|
-
|
|
358
|
+
// Bad packet from the mesh — log and skip, don't crash
|
|
359
|
+
console.warn('[Meshtastic] Decode error (skipping packet):', err.message);
|
|
357
360
|
}
|
|
358
361
|
});
|
|
359
362
|
|
|
360
363
|
socket.on('data', parser);
|
|
361
|
-
socket.on('error', () => this._onDisconnected(
|
|
364
|
+
socket.on('error', (err) => this._onDisconnected(`socket-error: ${err.message}`))
|
|
362
365
|
socket.on('end', () => this._onDisconnected('socket-end'));
|
|
363
366
|
socket.on('close', () => this._onDisconnected('socket-closed'));
|
|
364
367
|
socket.on('timeout', () => {
|