From 8ed99c2c136d4833376be3cc41bc673729cf722a Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 2 Aug 2018 16:42:25 +0400 Subject: [PATCH] exit from initSighupWatcher child goroutine also, remove excessive log message Refs #2072 --- libs/autofile/sighup_watcher.go | 12 +++++++++--- p2p/pex/addrbook.go | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/autofile/sighup_watcher.go b/libs/autofile/sighup_watcher.go index 56fbd4d86..f72f12fcd 100644 --- a/libs/autofile/sighup_watcher.go +++ b/libs/autofile/sighup_watcher.go @@ -18,13 +18,19 @@ var sighupCounter int32 // For testing func initSighupWatcher() { sighupWatchers = newSighupWatcher() - c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGHUP) + hup := make(chan os.Signal, 1) + signal.Notify(hup, syscall.SIGHUP) + + quit := make(chan os.Signal, 1) + signal.Notify(quit, os.Interrupt, syscall.SIGTERM) go func() { - for range c { + select { + case <-hup: sighupWatchers.closeAll() atomic.AddInt32(&sighupCounter, 1) + case <-quit: + return } }() } diff --git a/p2p/pex/addrbook.go b/p2p/pex/addrbook.go index ef7d7edaa..9596b1d76 100644 --- a/p2p/pex/addrbook.go +++ b/p2p/pex/addrbook.go @@ -496,7 +496,6 @@ out: } saveFileTicker.Stop() a.saveToFile(a.filePath) - a.Logger.Info("Address handler done") } //----------------------------------------------------------