@mega-yfue/eufy-sdk 0.4.0-beta.2 → 0.4.0-beta.3
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/dist/index.js +14 -2
- package/dist/index.js.map +2 -2
- package/dist/transport/p2p/p2p-session.d.ts +11 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15253,7 +15253,10 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
15253
15253
|
cloudLookup;
|
|
15254
15254
|
/** Local outbound IPv4 reported inside LOOKUP_WITH_KEY requests. */
|
|
15255
15255
|
selfHost;
|
|
15256
|
-
/**
|
|
15256
|
+
/**
|
|
15257
|
+
* In-flight multi-datagram frame per data channel (see reassemble): the payload gathered so far under its
|
|
15258
|
+
* parsed header, or, without a header, the start of a frame header cut by the datagram boundary.
|
|
15259
|
+
*/
|
|
15257
15260
|
pendingByDataType = /* @__PURE__ */ new Map();
|
|
15258
15261
|
/** Last delivered datagram sequence number per data type. */
|
|
15259
15262
|
lastSeqByType = /* @__PURE__ */ new Map();
|
|
@@ -16628,7 +16631,13 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
16628
16631
|
clearTimeout(reorder.timer);
|
|
16629
16632
|
reorder.timer = void 0;
|
|
16630
16633
|
}
|
|
16631
|
-
/**
|
|
16634
|
+
/**
|
|
16635
|
+
* Reassemble one in-sequence datagram body into logical frames.
|
|
16636
|
+
*
|
|
16637
|
+
* Frames are packed back to back, so a frame header can itself be cut by a datagram boundary. The start
|
|
16638
|
+
* of a header left at the end of a datagram is carried into the next one rather than discarded; dropping
|
|
16639
|
+
* it would lose that frame and every frame after it until a datagram happened to begin on a header.
|
|
16640
|
+
*/
|
|
16632
16641
|
reassemble(dataType, datagramBody) {
|
|
16633
16642
|
const pending = this.pendingByDataType.get(dataType);
|
|
16634
16643
|
let body = pending ? Buffer.concat([pending.buf, datagramBody]) : datagramBody;
|
|
@@ -16652,6 +16661,9 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
|
|
|
16652
16661
|
this.handleFrame(header, payload.subarray(0, header.bytesToRead), dataType);
|
|
16653
16662
|
body = body.subarray(P2P_DATA_HEADER_BYTES + header.bytesToRead);
|
|
16654
16663
|
}
|
|
16664
|
+
if (body.length > 0 && body.length < P2P_DATA_HEADER_BYTES && MAGIC_WORD.startsWith(body.subarray(0, 4).toString())) {
|
|
16665
|
+
this.pendingByDataType.set(dataType, { buf: body });
|
|
16666
|
+
}
|
|
16655
16667
|
}
|
|
16656
16668
|
/**
|
|
16657
16669
|
* Forget where each data type's sequence numbering had reached, and drop any half-reassembled frame.
|