From 97f35c4e5f4f24c46f35f9e801a9e656391145af Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 13 Jul 2021 20:30:35 +0300 Subject: [PATCH] don't respawn writer if we fail to open a stream; declare it a peer error --- comm.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/comm.go b/comm.go index d45ce804..5a9d0d85 100644 --- a/comm.go +++ b/comm.go @@ -13,7 +13,6 @@ import ( "github.com/libp2p/go-msgio/protoio" "github.com/gogo/protobuf/proto" - ms "github.com/multiformats/go-multistream" ) // get the initial RPC containing all of our subscriptions to send to new peers @@ -106,14 +105,11 @@ func (p *PubSub) handleNewPeer(ctx context.Context, pid peer.ID, outgoing <-chan if err != nil { log.Debug("opening new stream to peer: ", err, pid) - if err == ms.ErrNotSupported { - select { - case p.newPeerError <- pid: - case <-ctx.Done(): - } - } else { - p.notifyPeerDead(pid) + select { + case p.newPeerError <- pid: + case <-ctx.Done(): } + return }