From 85a1f01869a82172bf35af4995c39abf262aa35a Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 29 Oct 2021 11:42:20 +0300 Subject: [PATCH] clear peerPromises map when fullfilling a promise --- gossip_tracer.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gossip_tracer.go b/gossip_tracer.go index 3805e339..9ee9a24b 100644 --- a/gossip_tracer.go +++ b/gossip_tracer.go @@ -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) {