Skip to content

Commit

Permalink
don't respawn writer if we fail to open a stream; declare it a peer e…
Browse files Browse the repository at this point in the history
…rror
  • Loading branch information
vyzo committed Jul 13, 2021
1 parent b289ec5 commit e9e5a99
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions comm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit e9e5a99

Please sign in to comment.