Skip to content

Commit

Permalink
Merge pull request #8244 from Lasiar/perf/swarm/set-capacity
Browse files Browse the repository at this point in the history
perf: set an appropriate capacity
  • Loading branch information
Stebalien authored Aug 13, 2021
2 parents 1156e22 + 0a6d78c commit a945a9d
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 a945a9d

Please sign in to comment.