Copy netaddresses in AddressCache instead of referencing them.

While harmless, this prevents the race detector complaining when these
are then used. Closes #94
This commit is contained in:
Owain G. Ainsworth 2014-02-12 15:33:52 +00:00
parent 33082445c5
commit e20a3e9f2c

View file

@ -714,7 +714,8 @@ func (a *AddrManager) AddressCache() []*btcwire.NetAddress {
i := 0
// Iteration order is undefined here, but we randomise it anyway.
for _, v := range a.addrIndex {
allAddr[i] = v.na
copyNa := *v.na
allAddr[i] = &copyNa
i++
}
// Fisher-Yates shuffle the array