aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-12-01 16:30:19 +0800
committerGitHub <noreply@github.com>2016-12-01 16:30:19 +0800
commit717d2f6f9e157bf6962ecadb9ffb30362c733239 (patch)
treea96ec24477fb0b353880f36731da8442566a9f37
parent8cb95cb916e7e5c4f1595d976586999fcd9e209d (diff)
parent56b446190aedf7970c9532b1e428fbf1b5b94413 (diff)
downloadgo-tangerine-717d2f6f9e157bf6962ecadb9ffb30362c733239.tar
go-tangerine-717d2f6f9e157bf6962ecadb9ffb30362c733239.tar.gz
go-tangerine-717d2f6f9e157bf6962ecadb9ffb30362c733239.tar.bz2
go-tangerine-717d2f6f9e157bf6962ecadb9ffb30362c733239.tar.lz
go-tangerine-717d2f6f9e157bf6962ecadb9ffb30362c733239.tar.xz
go-tangerine-717d2f6f9e157bf6962ecadb9ffb30362c733239.tar.zst
go-tangerine-717d2f6f9e157bf6962ecadb9ffb30362c733239.zip
Merge pull request #3390 from bas-vk/statsd-stop
ethstats: check if received event is valid
-rw-r--r--ethstats/ethstats.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go
index b87f5ab78..a5fa84468 100644
--- a/ethstats/ethstats.go
+++ b/ethstats/ethstats.go
@@ -145,13 +145,21 @@ func (s *Service) loop() {
glog.V(logger.Warn).Infof("Full stats report failed: %v", err)
}
case head := <-headSub.Chan():
+ if head == nil { // node stopped
+ conn.Close()
+ return
+ }
if err = s.reportBlock(out, head.Data.(core.ChainHeadEvent).Block); err != nil {
glog.V(logger.Warn).Infof("Block stats report failed: %v", err)
}
if err = s.reportPending(out); err != nil {
glog.V(logger.Warn).Infof("Post-block transaction stats report failed: %v", err)
}
- case <-txSub.Chan():
+ case ev := <-txSub.Chan():
+ if ev == nil { // node stopped
+ conn.Close()
+ return
+ }
// Exhaust events to avoid reporting too frequently
for exhausted := false; !exhausted; {
select {