diff options
author | obscuren <geffobscura@gmail.com> | 2014-06-15 06:04:18 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-06-15 06:04:18 +0800 |
commit | b0e023e43248d09cb273d5b6025d28ee718151c0 (patch) | |
tree | 4b10f209106a9c7094472924fdd3401a566631ba | |
parent | 6d52da58d9337b786a0c869974daa91ce0e34a98 (diff) | |
download | go-tangerine-b0e023e43248d09cb273d5b6025d28ee718151c0.tar go-tangerine-b0e023e43248d09cb273d5b6025d28ee718151c0.tar.gz go-tangerine-b0e023e43248d09cb273d5b6025d28ee718151c0.tar.bz2 go-tangerine-b0e023e43248d09cb273d5b6025d28ee718151c0.tar.lz go-tangerine-b0e023e43248d09cb273d5b6025d28ee718151c0.tar.xz go-tangerine-b0e023e43248d09cb273d5b6025d28ee718151c0.tar.zst go-tangerine-b0e023e43248d09cb273d5b6025d28ee718151c0.zip |
Increase ping timeout to 30 seconds
-rw-r--r-- | peer.go | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -19,7 +19,7 @@ const ( // Current protocol version ProtocolVersion = 20 // Interval for ping/pong message - pingPongTimer = 1 * time.Second + pingPongTimer = 2 * time.Second ) type DiscReason byte @@ -266,14 +266,13 @@ out: select { // Main message queue. All outbound messages are processed through here case msg := <-p.outputQueue: - p.writeMessage(msg) p.lastSend = time.Now() // Ping timer case <-pingTimer.C: 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) p.Stop() return |