Skip to content

Commit

Permalink
Adds to infected when gossip received from 2nd and following senders
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Horowitz committed Nov 25, 2022
1 parent 3965890 commit b2ebaa9
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,15 @@ private void onGossipRequest(Message message) {
final long period = this.currentPeriod;
final GossipRequest gossipRequest = message.data();
for (Gossip gossip : gossipRequest.gossips()) {
GossipState gossipState = gossips.get(gossip.gossipId());
if (ensureSequence(gossip.gossiperId()).add(gossip.sequenceId())) {
GossipState gossipState = gossips.get(gossip.gossipId());
if (gossipState == null) { // new gossip
gossipState = new GossipState(gossip, period);
gossips.put(gossip.gossipId(), gossipState);
sink.emitNext(gossip.message(), RETRY_NON_SERIALIZED);
}
}
if (gossipState != null) {
gossipState.addToInfected(gossipRequest.from());
}
}
Expand Down

0 comments on commit b2ebaa9

Please sign in to comment.