Skip to content

Commit

Permalink
perf: set an appropriate capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
lasiar committed Jul 5, 2021
1 parent ae30699 commit 0a6d78c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/coreapi/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,16 @@ func (api *SwarmAPI) Peers(context.Context) ([]coreiface.ConnectionInfo, error)

conns := api.peerHost.Network().Conns()

var out []coreiface.ConnectionInfo
out := make([]coreiface.ConnectionInfo, 0, len(conns))
for _, c := range conns {
pid := c.RemotePeer()
addr := c.RemoteMultiaddr()

ci := &connInfo{
peerstore: api.peerstore,
conn: c,
dir: c.Stat().Direction,

addr: addr,
peer: pid,
addr: c.RemoteMultiaddr(),
peer: c.RemotePeer(),
}

/*
Expand Down

0 comments on commit 0a6d78c

Please sign in to comment.