Skip to content

Commit

Permalink
Merge pull request #379 from b9r5/AddToInfected2
Browse files Browse the repository at this point in the history
Adds to infected when gossip received from 2nd and following senders
  • Loading branch information
artem-v authored Dec 1, 2022
2 parents 170d23b + b2ebaa9 commit b7d8714
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 b7d8714

Please sign in to comment.