mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-06 02:52:19 +00:00
Increase ping timeout to 30 seconds
This commit is contained in:
parent
6d52da58d9
commit
b0e023e432
5
peer.go
5
peer.go
@ -19,7 +19,7 @@ const (
|
|||||||
// Current protocol version
|
// Current protocol version
|
||||||
ProtocolVersion = 20
|
ProtocolVersion = 20
|
||||||
// Interval for ping/pong message
|
// Interval for ping/pong message
|
||||||
pingPongTimer = 1 * time.Second
|
pingPongTimer = 2 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
type DiscReason byte
|
type DiscReason byte
|
||||||
@ -266,14 +266,13 @@ out:
|
|||||||
select {
|
select {
|
||||||
// Main message queue. All outbound messages are processed through here
|
// Main message queue. All outbound messages are processed through here
|
||||||
case msg := <-p.outputQueue:
|
case msg := <-p.outputQueue:
|
||||||
|
|
||||||
p.writeMessage(msg)
|
p.writeMessage(msg)
|
||||||
p.lastSend = time.Now()
|
p.lastSend = time.Now()
|
||||||
|
|
||||||
// Ping timer
|
// Ping timer
|
||||||
case <-pingTimer.C:
|
case <-pingTimer.C:
|
||||||
timeSince := time.Since(time.Unix(p.lastPong, 0))
|
timeSince := time.Since(time.Unix(p.lastPong, 0))
|
||||||
if !p.pingStartTime.IsZero() && p.lastPong != 0 && timeSince > (pingPongTimer+10*time.Second) {
|
if !p.pingStartTime.IsZero() && p.lastPong != 0 && timeSince > (pingPongTimer+30*time.Second) {
|
||||||
ethutil.Config.Log.Infof("[PEER] Peer did not respond to latest pong fast enough, it took %s, disconnecting.\n", timeSince)
|
ethutil.Config.Log.Infof("[PEER] Peer did not respond to latest pong fast enough, it took %s, disconnecting.\n", timeSince)
|
||||||
p.Stop()
|
p.Stop()
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user