mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-13 11:30:09 +08:00
we no longer use maps
This technically worked, but was extremely misleading.
This commit is contained in:
parent
f0e2dcd6b4
commit
9c4ac72897
@ -199,17 +199,17 @@ func (mgr *AddrManager) UpdateAddrs(p peer.ID, oldTTL time.Duration, newTTL time
|
||||
return
|
||||
}
|
||||
|
||||
amap, found := mgr.addrs[p]
|
||||
addrs, found := mgr.addrs[p]
|
||||
if !found {
|
||||
return
|
||||
}
|
||||
|
||||
exp := time.Now().Add(newTTL)
|
||||
for addrstr, aexp := range amap {
|
||||
for i := range addrs {
|
||||
aexp := &addrs[i]
|
||||
if oldTTL == aexp.TTL {
|
||||
aexp.TTL = newTTL
|
||||
aexp.Expires = exp
|
||||
amap[addrstr] = aexp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user