mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 18:00:46 +00:00
* ethstats: avoid blocking chan when received invalid stats request * ethstats: minor code polishes Co-authored-by: Hao Duan <duanhao0814@gmail.com> Co-authored-by: Péter Szilágyi <peterke@gmail.com>
This commit is contained in:
parent
65c7f4418f
commit
0a1bcdcbff
1 changed files with 7 additions and 4 deletions
|
|
@ -399,9 +399,12 @@ func (s *Service) readLoop(conn *connWrapper) {
|
||||||
// Make sure the request is valid and doesn't crash us
|
// Make sure the request is valid and doesn't crash us
|
||||||
request, ok := msg["emit"][1].(map[string]interface{})
|
request, ok := msg["emit"][1].(map[string]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Debug("Invalid stats history request", "msg", msg["emit"][1])
|
log.Warn("Invalid stats history request", "msg", msg["emit"][1])
|
||||||
s.histCh <- nil
|
select {
|
||||||
continue // Ethstats sometime sends invalid history requests, ignore those
|
case s.histCh <- nil: // Treat it as an no indexes request
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
list, ok := request["list"].([]interface{})
|
list, ok := request["list"].([]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
@ -429,7 +432,7 @@ func (s *Service) readLoop(conn *connWrapper) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// nodeInfo is the collection of metainformation about a node that is displayed
|
// nodeInfo is the collection of meta information about a node that is displayed
|
||||||
// on the monitoring page.
|
// on the monitoring page.
|
||||||
type nodeInfo struct {
|
type nodeInfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue