Skip to content

Commit

Permalink
clear peerPromises map when fullfilling a promise
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Oct 29, 2021
1 parent cee11bb commit 85a1f01
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gossip_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,19 @@ var _ RawTracer = (*gossipTracer)(nil)

func (gt *gossipTracer) fulfillPromise(msg *Message) {
mid := gt.msgID(msg.Message)
p := msg.ReceivedFrom

gt.Lock()
defer gt.Unlock()

delete(gt.promises, mid)
peerPromises, ok := gt.peerPromises[p]
if ok {
delete(peerPromises, mid)
if len(peerPromises) == 0 {
delete(gt.peerPromises, p)
}
}
}

func (gt *gossipTracer) DeliverMessage(msg *Message) {
Expand Down

0 comments on commit 85a1f01

Please sign in to comment.