mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-22 12:50:07 +08:00
pstoremem: fix slice preallocation in GetProtocols (#198)
This commit is contained in:
parent
f0dc314e08
commit
e9c56d257b
@ -131,7 +131,7 @@ func (pb *memoryProtoBook) GetProtocols(p peer.ID) ([]string, error) {
|
||||
s.RLock()
|
||||
defer s.RUnlock()
|
||||
|
||||
out := make([]string, 0, len(s.protocols))
|
||||
out := make([]string, 0, len(s.protocols[p]))
|
||||
for k := range s.protocols[p] {
|
||||
out = append(out, k)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user