aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-12-18 16:59:10 +0800
committerGitHub <noreply@github.com>2017-12-18 16:59:10 +0800
commit13db4af3450b952c78a09248aa7a6852b69bc0d6 (patch)
tree5abc71999e56d53ae17a3146ecfbeccf4b92edc0
parent64ee3e92eacaae5a10354357b22028016bc5240c (diff)
parentafa3c72c40eee45dfbf3cbc40505b78cb2c3c6b2 (diff)
downloaddexon-13db4af3450b952c78a09248aa7a6852b69bc0d6.tar
dexon-13db4af3450b952c78a09248aa7a6852b69bc0d6.tar.gz
dexon-13db4af3450b952c78a09248aa7a6852b69bc0d6.tar.bz2
dexon-13db4af3450b952c78a09248aa7a6852b69bc0d6.tar.lz
dexon-13db4af3450b952c78a09248aa7a6852b69bc0d6.tar.xz
dexon-13db4af3450b952c78a09248aa7a6852b69bc0d6.tar.zst
dexon-13db4af3450b952c78a09248aa7a6852b69bc0d6.zip
Merge pull request #15696 from ferhatelmas/p2p-goroutine-leak
p2p/discover: fix leaked goroutine in data expiration
-rw-r--r--p2p/discover/database.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/p2p/discover/database.go b/p2p/discover/database.go
index 7206a63c6..b136609f2 100644
--- a/p2p/discover/database.go
+++ b/p2p/discover/database.go
@@ -226,14 +226,14 @@ func (db *nodeDB) ensureExpirer() {
// expirer should be started in a go routine, and is responsible for looping ad
// infinitum and dropping stale data from the database.
func (db *nodeDB) expirer() {
- tick := time.Tick(nodeDBCleanupCycle)
+ tick := time.NewTicker(nodeDBCleanupCycle)
+ defer tick.Stop()
for {
select {
- case <-tick:
+ case <-tick.C:
if err := db.expireNodes(); err != nil {
log.Error("Failed to expire nodedb items", "err", err)
}
-
case <-db.quit:
return
}