@decentnetwork/peer 0.1.118 → 0.1.119
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 +23 -1
- package/package.json +1 -1
package/dist/peer.js
CHANGED
|
@@ -3163,8 +3163,30 @@ export class Peer {
|
|
|
3163
3163
|
return storedNodes;
|
|
3164
3164
|
}
|
|
3165
3165
|
waves += 1;
|
|
3166
|
-
// Pull the closest unvisited candidates for this wave.
|
|
3166
|
+
// Pull the closest unvisited candidates for this wave. Wave 1 reserves
|
|
3167
|
+
// slots for the BOOTSTRAP nodes: XOR-closest entries in our table are
|
|
3168
|
+
// mostly dead NAT'd peers, so a purely distance-ordered walk burned its
|
|
3169
|
+
// whole deadline before ever asking the only guaranteed-public,
|
|
3170
|
+
// always-on nodes. Announce storage capacity is large (toxcore keeps
|
|
3171
|
+
// ~160 entries, evicting furthest), so in this small network the fleet
|
|
3172
|
+
// WILL store us when asked — and every peer's lookup walk reaches the
|
|
3173
|
+
// fleet, so an announce stored there is universally findable.
|
|
3167
3174
|
const wave = [];
|
|
3175
|
+
if (waves === 1) {
|
|
3176
|
+
const bootstrapIdSet = new Set(this.#opts.bootstrapNodes.map((n) => `${n.host}:${n.port}`));
|
|
3177
|
+
for (let qi = 0; qi < queue.length && wave.length < 4;) {
|
|
3178
|
+
const c = queue[qi];
|
|
3179
|
+
const id = `${c.node.host}:${c.node.port}`;
|
|
3180
|
+
if (bootstrapIdSet.has(id) && !visited.has(id)) {
|
|
3181
|
+
visited.add(id);
|
|
3182
|
+
wave.push(c);
|
|
3183
|
+
queue.splice(qi, 1);
|
|
3184
|
+
}
|
|
3185
|
+
else {
|
|
3186
|
+
qi++;
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3168
3190
|
while (queue.length > 0 && wave.length < SELF_ANNOUNCE_BATCH_SIZE) {
|
|
3169
3191
|
const c = queue.shift();
|
|
3170
3192
|
const id = `${c.node.host}:${c.node.port}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/peer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.119",
|
|
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",
|