Unverified Commit 81e9caed authored by Hao Duan's avatar Hao Duan Committed by GitHub

ethstats: avoid blocking chan when received invalid stats request (#21073)

* ethstats: avoid blocking chan when received invalid stats request

* ethstats: minor code polishes
Co-authored-by: 's avatarPéter Szilágyi <peterke@gmail.com>
parent 7ddb4023
......@@ -320,8 +320,11 @@ func (s *Service) readLoop(conn *websocket.Conn) {
request, ok := msg["emit"][1].(map[string]interface{})
if !ok {
log.Warn("Invalid stats history request", "msg", msg["emit"][1])
s.histCh <- nil
continue // Ethstats sometime sends invalid history requests, ignore those
select {
case s.histCh <- nil: // Treat it as an no indexes request
default:
}
continue
}
list, ok := request["list"].([]interface{})
if !ok {
......@@ -349,7 +352,7 @@ func (s *Service) readLoop(conn *websocket.Conn) {
}
}
// 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.
type nodeInfo struct {
Name string `json:"name"`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment