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/devices/utils.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Device } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Converts a announce packet to a device object.
|
|
4
|
+
*
|
|
5
|
+
* Returns null for any packet that is not a stage-3 Pro DJ Link announce. The
|
|
6
|
+
* announce socket receives every UDP broadcast on its port, so foreign traffic
|
|
7
|
+
* (other apps, other protocols) is normal and must be ignored, not treated as
|
|
8
|
+
* an error.
|
|
4
9
|
*/
|
|
5
10
|
export declare function deviceFromPacket(packet: Buffer): Device | null;
|
package/lib/index.js
CHANGED
|
@@ -2127,7 +2127,16 @@ class DeviceManager {
|
|
|
2127
2127
|
this.off = __classPrivateFieldGet(this, _DeviceManager_emitter, "f").removeListener.bind(__classPrivateFieldGet(this, _DeviceManager_emitter, "f"));
|
|
2128
2128
|
this.once = __classPrivateFieldGet(this, _DeviceManager_emitter, "f").once.bind(__classPrivateFieldGet(this, _DeviceManager_emitter, "f"));
|
|
2129
2129
|
_DeviceManager_handleAnnounce.set(this, (message) => {
|
|
2130
|
-
|
|
2130
|
+
// This runs on every UDP datagram the announce socket receives, so a parse
|
|
2131
|
+
// failure here would surface as an uncaught exception on the socket and
|
|
2132
|
+
// crash the process. Foreign or truncated packets are ignored instead.
|
|
2133
|
+
let device;
|
|
2134
|
+
try {
|
|
2135
|
+
device = (0, utils_1.deviceFromPacket)(message);
|
|
2136
|
+
}
|
|
2137
|
+
catch {
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2131
2140
|
if (device === null) {
|
|
2132
2141
|
return;
|
|
2133
2142
|
}
|
|
@@ -2243,10 +2252,15 @@ const ip = __importStar(__webpack_require__(/*! ip-address */ "ip-address"));
|
|
|
2243
2252
|
const constants_1 = __webpack_require__(/*! src/constants */ "./src/constants.ts");
|
|
2244
2253
|
/**
|
|
2245
2254
|
* Converts a announce packet to a device object.
|
|
2255
|
+
*
|
|
2256
|
+
* Returns null for any packet that is not a stage-3 Pro DJ Link announce. The
|
|
2257
|
+
* announce socket receives every UDP broadcast on its port, so foreign traffic
|
|
2258
|
+
* (other apps, other protocols) is normal and must be ignored, not treated as
|
|
2259
|
+
* an error.
|
|
2246
2260
|
*/
|
|
2247
2261
|
function deviceFromPacket(packet) {
|
|
2248
2262
|
if (packet.indexOf(constants_1.PROLINK_HEADER) !== 0) {
|
|
2249
|
-
|
|
2263
|
+
return null;
|
|
2250
2264
|
}
|
|
2251
2265
|
if (packet[0x0a] !== 0x06) {
|
|
2252
2266
|
return null;
|