Skip to content

Commit

Permalink
Gossip- Don't log sending to empty slice of peers
Browse files Browse the repository at this point in the history
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 <yacovm@il.ibm.com>
Change-Id: I689f3163f496ac91629536e63a16d0e7effd99e3
  • Loading branch information
yacovm committed Feb 24, 2017
1 parent b274f53 commit a5365b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gossip/comm/comm_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (c *commImpl) createConnection(endpoint string, expectedPKIID common.PKIidT
}

func (c *commImpl) Send(msg *proto.GossipMessage, peers ...*RemotePeer) {
if c.isStopping() {
if c.isStopping() || len(peers) == 0 {
return
}

Expand Down

0 comments on commit a5365b9

Please sign in to comment.