Skip to content

Commit

Permalink
[FAB-11838] Add INFO logging for anchor peers
Browse files Browse the repository at this point in the history
This change set adds an INFO level logging message that contains
the endpoints of the anchor peers (and the corresponding org name)
whenever gossip channel reconfiguration takes place.

Change-Id: I9c2198917f0a230e8d50ca1d6d93c7824b71350b
Signed-off-by: yacovm <[email protected]>
  • Loading branch information
yacovm committed Sep 3, 2018
1 parent 15243b5 commit ca5b143
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gossip/gossip/gossip_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ func (g *gossipServiceImpl) JoinChan(joinMsg api.JoinChannelMessage, chainID com
// joinMsg is supposed to have been already verified
g.chanState.joinChannel(joinMsg, chainID)

g.logger.Info("Joining gossip network of channel", string(chainID), "with", len(joinMsg.Members()), "organizations")
for _, org := range joinMsg.Members() {
g.learnAnchorPeers(org, joinMsg.AnchorPeersOf(org))
g.learnAnchorPeers(string(chainID), org, joinMsg.AnchorPeersOf(org))
}
}

Expand Down Expand Up @@ -213,7 +214,12 @@ func (g *gossipServiceImpl) periodicalIdentityValidation(suspectFunc api.PeerSus
}
}

func (g *gossipServiceImpl) learnAnchorPeers(orgOfAnchorPeers api.OrgIdentityType, anchorPeers []api.AnchorPeer) {
func (g *gossipServiceImpl) learnAnchorPeers(channel string, orgOfAnchorPeers api.OrgIdentityType, anchorPeers []api.AnchorPeer) {
if len(anchorPeers) == 0 {
g.logger.Info("No configured anchor peers of", string(orgOfAnchorPeers), "for channel", channel, "to learn about")
return
}
g.logger.Info("Learning about the configured anchor peers of", string(orgOfAnchorPeers), "for channel", channel, ":", anchorPeers)
for _, ap := range anchorPeers {
if ap.Host == "" {
g.logger.Warning("Got empty hostname, skipping connecting to anchor peer", ap)
Expand Down

0 comments on commit ca5b143

Please sign in to comment.