hyperswarm
Advanced tools
Comparing version 4.7.1 to 4.7.2
@@ -20,2 +20,4 @@ const { EventEmitter } = require('events') | ||
const KEEP_ALIVE = b4a.alloc(0) | ||
module.exports = class Hyperswarm extends EventEmitter { | ||
@@ -274,6 +276,8 @@ constructor (opts = {}) { | ||
if (existing) { | ||
// if both connections are from the same peer, pick newest. otherwise tie break based on pub keys | ||
const keepNew = conn.isInitiator === existing.isInitiator || b4a.compare(conn.publicKey, conn.remotePublicKey) > 0 | ||
const expectedInitiator = b4a.compare(conn.publicKey, conn.remotePublicKey) > 0 | ||
// if both connections are from the same peer, pick the one thats expected to initiate in a tie break | ||
const keepNew = expectedInitiator === conn.isInitiator | ||
if (keepNew === false) { | ||
existing.write(KEEP_ALIVE) // check to see if its still alive actually | ||
conn.on('error', noop) | ||
@@ -280,0 +284,0 @@ conn.destroy(new Error(ERR_DUPLICATE)) |
{ | ||
"name": "hyperswarm", | ||
"version": "4.7.1", | ||
"version": "4.7.2", | ||
"description": "A distributed networking stack for connecting peers", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
36709
825