From 5c50db535711890e61267dd5147c1fb24a87a5d6 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 23 Oct 2015 23:06:24 -0500 Subject: [PATCH] peer: Don't stall on pongs. --- peer/peer.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/peer/peer.go b/peer/peer.go index 32f9388f..70484f09 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -1261,6 +1261,11 @@ func (p *Peer) shouldHandleReadError(err error) bool { // response for the passed wire protocol command to the pending responses map. func (p *Peer) maybeAddDeadline(pendingResponses map[string]time.Time, msgCmd string) { // Setup a deadline for each message being sent that expects a response. + // + // NOTE: Pings are intentionally ignored here since they are typically + // sent asynchronously and as a result of a long backlock of messages, + // such as is typical in the case of initial block download, the + // response won't be received in time. deadline := time.Now().Add(stallResponseTimeout) switch msgCmd { case wire.CmdVersion: @@ -1271,12 +1276,6 @@ func (p *Peer) maybeAddDeadline(pendingResponses map[string]time.Time, msgCmd st // Expects an addr message. pendingResponses[wire.CmdAddr] = deadline - case wire.CmdPing: - // Expects a pong message in later protocol versions. - if p.ProtocolVersion() > wire.BIP0031Version { - pendingResponses[wire.CmdPong] = deadline - } - case wire.CmdMemPool: // Expects an inv message. pendingResponses[wire.CmdInv] = deadline