mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
parent
48f93a8cc5
commit
e34aea99f0
1 changed files with 4 additions and 1 deletions
|
|
@ -574,10 +574,13 @@ func (s *Service) reportLatency(conn *connWrapper) error {
|
|||
return err
|
||||
}
|
||||
// Wait for the pong request to arrive back
|
||||
timer := time.NewTimer(5 * time.Second)
|
||||
defer timer.Stop()
|
||||
|
||||
select {
|
||||
case <-s.pongCh:
|
||||
// Pong delivered, report the latency
|
||||
case <-time.After(5 * time.Second):
|
||||
case <-timer.C:
|
||||
// Ping timeout, abort
|
||||
return errors.New("ping timed out")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue