Fix reference counting when expiring peers.
This commit is contained in:
parent
340e8b999e
commit
3afdc43e69
1 changed files with 2 additions and 2 deletions
|
@ -261,9 +261,9 @@ func (a *AddrManager) expireNew(bucket int) {
|
||||||
if bad(v) {
|
if bad(v) {
|
||||||
log.Tracef("AMGR: expiring bad address %v", k)
|
log.Tracef("AMGR: expiring bad address %v", k)
|
||||||
delete(a.addrNew[bucket], k)
|
delete(a.addrNew[bucket], k)
|
||||||
a.nNew--
|
|
||||||
v.refs--
|
v.refs--
|
||||||
if v.refs == 0 {
|
if v.refs == 0 {
|
||||||
|
a.nNew--
|
||||||
delete(a.addrIndex, k)
|
delete(a.addrIndex, k)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -280,9 +280,9 @@ func (a *AddrManager) expireNew(bucket int) {
|
||||||
log.Tracef("AMGR: expiring oldest address %v", key)
|
log.Tracef("AMGR: expiring oldest address %v", key)
|
||||||
|
|
||||||
delete(a.addrNew[bucket], key)
|
delete(a.addrNew[bucket], key)
|
||||||
a.nNew--
|
|
||||||
oldest.refs--
|
oldest.refs--
|
||||||
if oldest.refs == 0 {
|
if oldest.refs == 0 {
|
||||||
|
a.nNew--
|
||||||
delete(a.addrIndex, key)
|
delete(a.addrIndex, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue