do not use mutliple read locks (#3812)

This commit is contained in:
Preston Van Loon 2019-10-20 22:37:39 -07:00 committed by GitHub
parent 635e20529a
commit d8e70fe83c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ func Count() int {
func Keys() []peer.ID {
lock.RLock()
defer lock.RUnlock()
keys := make([]peer.ID, 0, Count())
keys := make([]peer.ID, 0, len(peerStatuses))
for k := range peerStatuses {
keys = append(keys, k)
}