Skip to content

Commit 3e1a17e

Browse files
committed
[FAB-5499]: Flatten logic of gossip Peers API
Current implmenetaition makes use of discovery GetMembership API and iterates over to construct the result, while this is redundant, since we can return GetMembership result right away. This commit replace iteration with simply returning result of discovery service. Change-Id: Idd69acd08560e0fac84bae43cd8acd50e6d8bdd0 Signed-off-by: Artem Barger <bartem@il.ibm.com>
1 parent f3d0f5c commit 3e1a17e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

gossip/gossip/gossip_impl.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,7 @@ func (g *gossipServiceImpl) Send(msg *proto.GossipMessage, peers ...*comm.Remote
646646

647647
// GetPeers returns a mapping of endpoint --> []discovery.NetworkMember
648648
func (g *gossipServiceImpl) Peers() []discovery.NetworkMember {
649-
s := []discovery.NetworkMember{}
650-
for _, member := range g.disc.GetMembership() {
651-
s = append(s, member)
652-
}
653-
return s
654-
649+
return g.disc.GetMembership()
655650
}
656651

657652
// PeersOfChannel returns the NetworkMembers considered alive

0 commit comments

Comments
 (0)