Skip to content

Commit a5365b9

Browse files
committed
Gossip- Don't log sending to empty slice of peers
The code that uses the gossip comm layer's Send() method computes dynamically a set of peers to send a message to, usually out of a batch of all kinds of messages. As a result, the peer set passed to the send method is sometimes empty. This makes the gossip comm layer log something like "sending Msg M to 0 peers". I added a check that makes the Send() function skip sending if the peer slice passed is empty. Signed-off-by: Yacov Manevich <[email protected]> Change-Id: I689f3163f496ac91629536e63a16d0e7effd99e3
1 parent b274f53 commit a5365b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gossip/comm/comm_impl.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (c *commImpl) createConnection(endpoint string, expectedPKIID common.PKIidT
212212
}
213213

214214
func (c *commImpl) Send(msg *proto.GossipMessage, peers ...*RemotePeer) {
215-
if c.isStopping() {
215+
if c.isStopping() || len(peers) == 0 {
216216
return
217217
}
218218

0 commit comments

Comments
 (0)