From 0aa1ce734370eb3be160f91f8f0cf1f64849885b Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 5 Apr 2018 16:39:05 -0400 Subject: [PATCH] kill printstate when dht stops --- dht/dht.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dht/dht.go b/dht/dht.go index 791aeff..f12bf79 100644 --- a/dht/dht.go +++ b/dht/dht.go @@ -168,7 +168,11 @@ func (dht *DHT) init() error { t := time.NewTicker(dht.conf.PrintState) for { dht.PrintState() - <-t.C + select { + case <-t.C: + case <-dht.stop.Chan(): + return + } } }() }