epidemic-broadcast-trees
Advanced tools
Comparing version 8.0.2 to 8.0.3
@@ -46,3 +46,3 @@ 'use strict' | ||
} | ||
// lower numbers should be respected | ||
@@ -188,5 +188,5 @@ // if one is -1 and the other is not, use the other | ||
sent: null, | ||
requested: state.clock[id] | ||
requested: lseq | ||
} | ||
setNotes(peer, id, state.clock[id] || 0, !replicating) | ||
setNotes(peer, id, lseq, !replicating) | ||
} | ||
@@ -215,3 +215,3 @@ } | ||
// peer rejects feed | ||
var seq = peer.clock[ev.id], lseq = state.clock[ev.id] || 0 | ||
var seq = peer.clock[ev.id] || 0, lseq = state.clock[ev.id] || 0 | ||
if(seq === -1) { | ||
@@ -223,3 +223,3 @@ //peer explicitly does not replicate this feed, don't ask for it. | ||
} | ||
else if(ev.value === true && seq != lseq) { | ||
else if(ev.value === true && seq !== state.clock[ev.id]) { | ||
peer.replicating[ev.id] = { | ||
@@ -226,0 +226,0 @@ rx: true, tx: false, |
{ | ||
"name": "epidemic-broadcast-trees", | ||
"description": "", | ||
"version": "8.0.2", | ||
"description": "bandwidth efficient broadcast gossip", | ||
"version": "8.0.3", | ||
"homepage": "https://github.com/dominictarr/epidemic-broadcast-trees", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -195,2 +195,17 @@ var test = require('tape') | ||
test('replicate a hops=2 peer that my hops=1 friend still doesnt have', function (t) { | ||
var state = events.initialize() | ||
state = events.clock(state, {}) | ||
state = events.connect(state, {id: 'alice', client: false}) | ||
state = events.peerClock(state, {id: 'alice', value: {'alice': 0, 'bob': 0}}) | ||
state = events.follow(state, {id: 'alice', value: true}) | ||
state = events.follow(state, {id: 'bob', value: true}) | ||
t.ok(state.peers['alice'].replicating['bob']) | ||
t.end() | ||
}) | ||
test('reply to any clock they send, 1', function (t) { | ||
@@ -360,3 +375,3 @@ var state = { | ||
t.deepEqual(state.peers.bob.notes, {alice: note(4, false)}) | ||
t.end() | ||
@@ -363,0 +378,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
105160
2411
1