From e263216e1fdde5a8bf1a73375bcfb509b1a6c9c1 Mon Sep 17 00:00:00 2001 From: Alexander Sporn Date: Wed, 14 Sep 2022 11:46:14 +0200 Subject: [PATCH] Drop connection to peer if the stream is closed --- pkg/protocol/gossip/service.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/protocol/gossip/service.go b/pkg/protocol/gossip/service.go index 856a772ccc..96412e8354 100644 --- a/pkg/protocol/gossip/service.go +++ b/pkg/protocol/gossip/service.go @@ -562,6 +562,12 @@ func (s *Service) deregisterProtocol(peerID peer.ID) error { return fmt.Errorf("unable to cleanly reset stream to %s: %w", peerID, err) } + // Drop connection to peer since we no longer have a protocol stream to it + conn := proto.Stream.Conn() + if conn != nil { + return conn.Close() + } + return nil }