Skip to content

Commit

Permalink
Merge pull request ethereum#15696 from ferhatelmas/p2p-goroutine-leak
Browse files Browse the repository at this point in the history
p2p/discover: fix leaked goroutine in data expiration
  • Loading branch information
karalabe authored Dec 18, 2017
2 parents 64ee3e9 + afa3c72 commit 13db4af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions p2p/discover/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 13db4af

Please sign in to comment.