提交 56b44619 编写于 作者: B Bas van Kervel

ethstats: check if received event is valid

上级 86f9e836
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册