@decentnetwork/peer 0.1.48 → 0.1.49
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/peer.js +20 -8
- package/package.json +1 -1
package/dist/peer.js
CHANGED
|
@@ -1551,14 +1551,26 @@ export class Peer {
|
|
|
1551
1551
|
if (!opened) {
|
|
1552
1552
|
continue;
|
|
1553
1553
|
}
|
|
1554
|
-
// De-duplicate. The dual-send path
|
|
1555
|
-
// BOTH
|
|
1556
|
-
// without this guard
|
|
1557
|
-
//
|
|
1558
|
-
//
|
|
1559
|
-
//
|
|
1560
|
-
//
|
|
1561
|
-
|
|
1554
|
+
// De-duplicate — but ONLY for dual-sent channels. The dual-send path
|
|
1555
|
+
// delivers a lossless packet over BOTH UDP and relay with the SAME
|
|
1556
|
+
// packet number, so without this guard a chat message is dispatched
|
|
1557
|
+
// (stored / shown) twice. Drop anything at or below the receive
|
|
1558
|
+
// low-water mark, like toxcore net_crypto drops below buffer_start.
|
|
1559
|
+
//
|
|
1560
|
+
// EXCEPT single-transport channels (bulk IP = bulkDataPacketId, and
|
|
1561
|
+
// file transfer 80-82): they are NOT dual-sent, so they never produce
|
|
1562
|
+
// duplicates — and the low-water mark would then only drop a
|
|
1563
|
+
// legitimately REORDERED packet, which over a high-rate stream (CCTV
|
|
1564
|
+
// over a long-haul China↔US path that reorders) is pure added loss /
|
|
1565
|
+
// jitter. IP forwarding is order-independent (the TUN/TCP above
|
|
1566
|
+
// reassembles), so deliver every packet. Must run BEFORE the nonce
|
|
1567
|
+
// advance so a real duplicate doesn't desync the receive nonce.
|
|
1568
|
+
const innerKind = opened.payload.length > 0 ? opened.payload[0] : -1;
|
|
1569
|
+
const isSingleTransportKind = (this.#opts.bulkDataPacketId !== undefined && innerKind === this.#opts.bulkDataPacketId) ||
|
|
1570
|
+
innerKind === PACKET_ID_FILE_SENDREQUEST ||
|
|
1571
|
+
innerKind === PACKET_ID_FILE_CONTROL ||
|
|
1572
|
+
innerKind === PACKET_ID_FILE_DATA;
|
|
1573
|
+
if (!isSingleTransportKind && opened.packetNumber < (state.receiveBufferStart ?? 0)) {
|
|
1562
1574
|
continue;
|
|
1563
1575
|
}
|
|
1564
1576
|
state.peerBaseNonce[state.peerBaseNonce.length - 2] = packet[1];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/peer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
4
4
|
"description": "Pure TypeScript port of Elastos Carrier (toxcore-derived) P2P messaging. DHT, onion routing, TCP relay, FlatBuffers app payloads, Express offline relay. Wire-compatible with iOS Beagle and the Carrier C SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|