alphatheta-connect 0.28.2 → 0.28.4
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/lib/cli.js +16 -2
- package/lib/cli.js.map +1 -1
- package/lib/devices/utils.d.ts +5 -0
- package/lib/index.js +16 -2
- package/lib/index.js.map +1 -1
- package/lib/remotedb/fields.d.ts +6 -6
- package/package.json +2 -5
package/lib/cli.js
CHANGED
|
@@ -2238,7 +2238,16 @@ class DeviceManager {
|
|
|
2238
2238
|
this.off = __classPrivateFieldGet(this, _DeviceManager_emitter, "f").removeListener.bind(__classPrivateFieldGet(this, _DeviceManager_emitter, "f"));
|
|
2239
2239
|
this.once = __classPrivateFieldGet(this, _DeviceManager_emitter, "f").once.bind(__classPrivateFieldGet(this, _DeviceManager_emitter, "f"));
|
|
2240
2240
|
_DeviceManager_handleAnnounce.set(this, (message) => {
|
|
2241
|
-
|
|
2241
|
+
// This runs on every UDP datagram the announce socket receives, so a parse
|
|
2242
|
+
// failure here would surface as an uncaught exception on the socket and
|
|
2243
|
+
// crash the process. Foreign or truncated packets are ignored instead.
|
|
2244
|
+
let device;
|
|
2245
|
+
try {
|
|
2246
|
+
device = (0, utils_1.deviceFromPacket)(message);
|
|
2247
|
+
}
|
|
2248
|
+
catch {
|
|
2249
|
+
return;
|
|
2250
|
+
}
|
|
2242
2251
|
if (device === null) {
|
|
2243
2252
|
return;
|
|
2244
2253
|
}
|
|
@@ -2354,10 +2363,15 @@ const ip = __importStar(__webpack_require__(/*! ip-address */ "ip-address"));
|
|
|
2354
2363
|
const constants_1 = __webpack_require__(/*! src/constants */ "./src/constants.ts");
|
|
2355
2364
|
/**
|
|
2356
2365
|
* Converts a announce packet to a device object.
|
|
2366
|
+
*
|
|
2367
|
+
* Returns null for any packet that is not a stage-3 Pro DJ Link announce. The
|
|
2368
|
+
* announce socket receives every UDP broadcast on its port, so foreign traffic
|
|
2369
|
+
* (other apps, other protocols) is normal and must be ignored, not treated as
|
|
2370
|
+
* an error.
|
|
2357
2371
|
*/
|
|
2358
2372
|
function deviceFromPacket(packet) {
|
|
2359
2373
|
if (packet.indexOf(constants_1.PROLINK_HEADER) !== 0) {
|
|
2360
|
-
|
|
2374
|
+
return null;
|
|
2361
2375
|
}
|
|
2362
2376
|
if (packet[0x0a] !== 0x06) {
|
|
2363
2377
|
return null;
|