mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-13 07:29:30 +01:00
fix a memory leak
Even after the timer fired, we were retaining a pointer to it; clean those up too along with the other cleanup tasks.
This commit is contained in:
parent
854d85a474
commit
96737ea6d7
@ -158,6 +158,7 @@ func (dm *DLineManager) addNetworkInternal(network net.IPNet, info IPBanInfo) (i
|
|||||||
if ok && netBan.Info.TimeCreated.Equal(timeCreated) {
|
if ok && netBan.Info.TimeCreated.Equal(timeCreated) {
|
||||||
delete(dm.networks, id)
|
delete(dm.networks, id)
|
||||||
// TODO(slingamn) here's where we'd remove it from the radix tree
|
// TODO(slingamn) here's where we'd remove it from the radix tree
|
||||||
|
delete(dm.expirationTimers, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dm.expirationTimers[id] = time.AfterFunc(timeLeft, processExpiration)
|
dm.expirationTimers[id] = time.AfterFunc(timeLeft, processExpiration)
|
||||||
|
@ -113,6 +113,7 @@ func (km *KLineManager) addMaskInternal(mask string, info IPBanInfo) {
|
|||||||
maskBan, ok := km.entries[mask]
|
maskBan, ok := km.entries[mask]
|
||||||
if ok && maskBan.Info.TimeCreated.Equal(timeCreated) {
|
if ok && maskBan.Info.TimeCreated.Equal(timeCreated) {
|
||||||
delete(km.entries, mask)
|
delete(km.entries, mask)
|
||||||
|
delete(km.expirationTimers, mask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
km.expirationTimers[mask] = time.AfterFunc(timeLeft, processExpiration)
|
km.expirationTimers[mask] = time.AfterFunc(timeLeft, processExpiration)
|
||||||
|
Loading…
Reference in New Issue
Block a user