hyperswarm
Advanced tools
Comparing version 4.5.0 to 4.5.1
21
index.js
@@ -83,2 +83,4 @@ const { EventEmitter } = require('events') | ||
for (const peerInfo of batch) { | ||
peerInfo.waiting = false | ||
if ((peerInfo._updatePriority() === false) || this._allConnections.has(peerInfo.publicKey) || peerInfo.queued) continue | ||
@@ -161,3 +163,6 @@ peerInfo.queued = true | ||
peerInfo._disconnected() | ||
if (this._shouldRequeue(peerInfo)) this._timer.add(peerInfo) | ||
peerInfo.waiting = this._shouldRequeue(peerInfo) && this._timer.add(peerInfo) | ||
this._maybeDeletePeer(peerInfo) | ||
if (!opened) this._flushMaybe(peerInfo) | ||
@@ -273,2 +278,4 @@ | ||
this._maybeDeletePeer(peerInfo) | ||
this._attemptClientConnections() | ||
@@ -299,2 +306,12 @@ | ||
_maybeDeletePeer (peerInfo) { | ||
if (!peerInfo.shouldGC()) return | ||
const hasActiveConn = this._allConnections.has(peerInfo.publicKey) | ||
if (hasActiveConn) return | ||
const keyString = b4a.toString(peerInfo.publicKey, 'hex') | ||
this.peers.delete(keyString) | ||
} | ||
/* | ||
@@ -387,5 +404,7 @@ * Called when a peer is actively discovered during a lookup. | ||
if (!this.peers.has(keyString)) return | ||
const peerInfo = this.peers.get(keyString) | ||
peerInfo.explicit = false | ||
this.explicitPeers.delete(peerInfo) | ||
this._maybeDeletePeer(peerInfo) | ||
} | ||
@@ -392,0 +411,0 @@ |
@@ -22,2 +22,3 @@ const { EventEmitter } = require('events') | ||
this.explicit = false | ||
this.waiting = false | ||
@@ -101,2 +102,6 @@ // Set by the Swarm | ||
} | ||
shouldGC () { | ||
return !(this.banned || this.queued || this.explicit || this.waiting) | ||
} | ||
} |
@@ -47,4 +47,6 @@ const BulkTimer = require('./bulk-timer') | ||
const timer = this._selectRetryTimer(peerInfo) | ||
if (!timer) return null | ||
if (!timer) return false | ||
timer.add(peerInfo) | ||
return true | ||
} | ||
@@ -51,0 +53,0 @@ |
{ | ||
"name": "hyperswarm", | ||
"version": "4.5.0", | ||
"version": "4.5.1", | ||
"description": "A distributed networking stack for connecting peers", | ||
@@ -12,3 +12,3 @@ "files": [ | ||
"events": "^3.3.0", | ||
"hyperdht": "^6.5.2", | ||
"hyperdht": "^6.6.0", | ||
"safety-catch": "^1.0.2", | ||
@@ -18,3 +18,2 @@ "shuffled-priority-queue": "^2.1.0" | ||
"devDependencies": { | ||
"@hyperswarm/testnet": "^3.0.0", | ||
"brittle": "^3.0.2", | ||
@@ -21,0 +20,0 @@ "hypercore-crypto": "^2.3.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34834
5
762
Updatedhyperdht@^6.6.0