Merge pull request #34 from libp2p/fix/go-ipfs/4066

drop messages to slow peers
This commit is contained in:
Steven Allen 2017-09-04 16:24:19 -07:00 committed by GitHub
commit d1d3a55404
1 changed files with 6 additions and 1 deletions

View File

@ -351,7 +351,12 @@ func (p *PubSub) publishMessage(from peer.ID, msg *pb.Message) error {
continue
}
go func() { mch <- out }()
select {
case mch <- out:
default:
log.Infof("dropping message to peer %s: queue full", pid)
// Drop it. The peer is too slow.
}
}
return nil