Branch: refs/heads/master
  Home:   https://github.com/btcsuite/btcd
  Commit: cbbe3a8bbe7bcabe7f31883428b619487dfdecdd
      
https://github.com/btcsuite/btcd/commit/cbbe3a8bbe7bcabe7f31883428b619487dfdecdd
  Author: Dave Collins <da...@conformal.com>
  Date:   2015-10-23 (Fri, 23 Oct 2015)

  Changed paths:
    M peer/peer.go

  Log Message:
  -----------
  peer: Implement stall detection.

This commit implements stall detection logic at the peer level to detect
and disconnect peers that are either not following the protocol in
regards to expected response messages or have otherwise stalled.  This
is accomplished by setting deadlines for each message type which expects
a response and periodically checking them while properly taking into
account processing time.

There are an increasing number of nodes on the network which claim to be
full nodes, but don't actually properly implement the entire p2p
protocol even though they implement it enough to cause properly
implemented nodes to make data requests to which they never respond.

Since btcd currently only syncs new blocks via single sync peer and,
prior to this commit only had very basic stall detection, this could
lead to a situation where the block download became stalled indefinitely
due to one of these misbehaving peers.  This commit fixes that issue
since the stalled peer will now be detected and disconnected which leads
to a new sync peer being selected.

This logic will also fit nicely with the future multi-peer sync model
which is on the roadmap and for which infrastructure work is underway.

Fixes #486 and fixes #229.


Reply via email to