@mega-yfue/eufy-sdk 0.3.0-beta.1 → 0.3.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 +106 -16
- package/dist/index.js.map +2 -2
- package/dist/transport/p2p/p2p-session.d.ts +25 -7
- package/package.json +1 -1
|
@@ -136,9 +136,10 @@ export declare class P2PSession extends EventEmitter {
|
|
|
136
136
|
private selfHost?;
|
|
137
137
|
/** In-flight multi-datagram frame per data channel (see onData). */
|
|
138
138
|
private readonly pendingByDataType;
|
|
139
|
-
/** Last datagram sequence number
|
|
140
|
-
* mid-frame and drop the (now unrecoverable) partial frame instead of splicing wrong bytes. */
|
|
139
|
+
/** Last delivered datagram sequence number per data type. */
|
|
141
140
|
private readonly lastSeqByType;
|
|
141
|
+
/** Held datagrams and their active gap timer, grouped by data type. */
|
|
142
|
+
private readonly reorderByType;
|
|
142
143
|
private tracedDatagramGaps;
|
|
143
144
|
private readonly level1Key;
|
|
144
145
|
/** Negotiated 32-byte level-2/gateway key (AES-256-GCM). Set via setLevel2Key once known. */
|
|
@@ -611,8 +612,7 @@ export declare class P2PSession extends EventEmitter {
|
|
|
611
612
|
* Acknowledge and reassemble one DATA datagram, sequenced independently per data type.
|
|
612
613
|
*
|
|
613
614
|
* The device numbers each data type's datagrams in its own 16-bit space and repeats what it thinks was
|
|
614
|
-
* lost
|
|
615
|
-
* retransmission of something already reassembled: it is acknowledged, then ignored. Distance is measured
|
|
615
|
+
* lost. A repeat of something already delivered is acknowledged, then ignored. Distance is measured
|
|
616
616
|
* modulo the sequence space and read as backwards beyond {@link SEQUENCE_LOOKBACK}, which is what lets the
|
|
617
617
|
* numbering wrap without the next datagram looking like a jump of nearly a full space.
|
|
618
618
|
*
|
|
@@ -622,11 +622,29 @@ export declare class P2PSession extends EventEmitter {
|
|
|
622
622
|
* numbering and the half-assembled frame goes — because ignoring it would freeze the mark, and every
|
|
623
623
|
* datagram of the new numbering would then be read as behind it too, for as long as it took to climb back.
|
|
624
624
|
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
625
|
+
* A forward gap means a datagram has not arrived YET, which is not the same as lost. The device repeats
|
|
626
|
+
* unacknowledged datagrams, so successors are held for a bounded wait and delivered strictly in sequence
|
|
627
|
+
* if the missing one arrives. A logical frame's payload spans datagrams that carry no header of their
|
|
628
|
+
* own, so reassembling around a hole is impossible; waiting for it is what keeps the frame whole.
|
|
629
|
+
*
|
|
630
|
+
* Only once {@link REORDER_WAIT_MS} passes, or {@link REORDER_MAX_DATAGRAMS} pile up, is the datagram
|
|
631
|
+
* treated as lost: a pending frame is discarded and delivery resumes from the earliest held datagram.
|
|
628
632
|
*/
|
|
629
633
|
private onData;
|
|
634
|
+
/** Hold a datagram that arrived past a hole, and arm the wait for the missing one to be repeated. */
|
|
635
|
+
private holdForRetransmit;
|
|
636
|
+
/** Start a full wait for the current hole, leaving an existing wait undisturbed. */
|
|
637
|
+
private armReorderTimer;
|
|
638
|
+
/** Deliver held datagrams that now follow directly on from the last one delivered. */
|
|
639
|
+
private drainReorder;
|
|
640
|
+
/**
|
|
641
|
+
* The missing datagram was not repeated in time: report the gap, drop the frame it belonged to, and
|
|
642
|
+
* resume from the earliest datagram still held so the stream keeps moving.
|
|
643
|
+
*/
|
|
644
|
+
private abandonHole;
|
|
645
|
+
private clearReorderTimer;
|
|
646
|
+
/** Reassemble one in-sequence datagram body into logical frames. */
|
|
647
|
+
private reassemble;
|
|
630
648
|
/**
|
|
631
649
|
* Forget where each data type's sequence numbering had reached, and drop any half-reassembled frame.
|
|
632
650
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mega-yfue/eufy-sdk",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.3",
|
|
4
4
|
"description": "One typed TypeScript client for the Anker eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "mega-yfue",
|