Skip to content

Commit

Permalink
map len reading moved into RLock
Browse files Browse the repository at this point in the history
  • Loading branch information
shvydky committed Aug 31, 2020
1 parent 0970431 commit 205e432
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion peerdiscovery.go
Expand Up @@ -221,9 +221,9 @@ func Discover(settings ...Settings) (discoveries []Discovered, err error) {
broadcast(p2, payload, ifaces, &net.UDPAddr{IP: group, Port: portNum})
}

p.RLock()
discoveries = make([]Discovered, len(p.received))
i := 0
p.RLock()
for ip, payload := range p.received {
discoveries[i] = Discovered{
Address: ip,
Expand Down

0 comments on commit 205e432

Please sign in to comment.