From 44fa2c63711e3fe63feee9c5381a35321bdaa93d Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Mon, 13 Jan 2020 10:15:09 +0000 Subject: [PATCH] Only one handshake at a time with active peers (#4519) --- beacon-chain/p2p/handshake.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon-chain/p2p/handshake.go b/beacon-chain/p2p/handshake.go index 29dc51e82..0040816f6 100644 --- a/beacon-chain/p2p/handshake.go +++ b/beacon-chain/p2p/handshake.go @@ -22,8 +22,8 @@ func (s *Service) AddConnectionHandler(reqFunc func(ctx context.Context, id peer // Handle the various pre-existing conditions that will result in us not handshaking. peerConnectionState, err := s.peers.ConnectionState(conn.RemotePeer()) - if err == nil && peerConnectionState == peers.PeerConnected { - log.Debug("Peer already connected; not handshaking again") + if err == nil && (peerConnectionState == peers.PeerConnected || peerConnectionState == peers.PeerConnecting) { + log.WithField("currentState", peerConnectionState).Debug("Peer already active; not handshaking again") return } s.peers.Add(conn.RemotePeer(), conn.RemoteMultiaddr(), conn.Stat().Direction)