mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 12:06:40 +00:00
Merge pull request #3390 from bas-vk/statsd-stop
ethstats: check if received event is valid
This commit is contained in:
commit
717d2f6f9e
1 changed files with 9 additions and 1 deletions
|
|
@ -145,13 +145,21 @@ func (s *Service) loop() {
|
||||||
glog.V(logger.Warn).Infof("Full stats report failed: %v", err)
|
glog.V(logger.Warn).Infof("Full stats report failed: %v", err)
|
||||||
}
|
}
|
||||||
case head := <-headSub.Chan():
|
case head := <-headSub.Chan():
|
||||||
|
if head == nil { // node stopped
|
||||||
|
conn.Close()
|
||||||
|
return
|
||||||
|
}
|
||||||
if err = s.reportBlock(out, head.Data.(core.ChainHeadEvent).Block); err != nil {
|
if err = s.reportBlock(out, head.Data.(core.ChainHeadEvent).Block); err != nil {
|
||||||
glog.V(logger.Warn).Infof("Block stats report failed: %v", err)
|
glog.V(logger.Warn).Infof("Block stats report failed: %v", err)
|
||||||
}
|
}
|
||||||
if err = s.reportPending(out); err != nil {
|
if err = s.reportPending(out); err != nil {
|
||||||
glog.V(logger.Warn).Infof("Post-block transaction stats report failed: %v", err)
|
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
|
// Exhaust events to avoid reporting too frequently
|
||||||
for exhausted := false; !exhausted; {
|
for exhausted := false; !exhausted; {
|
||||||
select {
|
select {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue