mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
Only one handshake at a time with active peers (#4519)
This commit is contained in:
parent
a8edfa42cc
commit
44fa2c6371
@ -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.
|
// Handle the various pre-existing conditions that will result in us not handshaking.
|
||||||
peerConnectionState, err := s.peers.ConnectionState(conn.RemotePeer())
|
peerConnectionState, err := s.peers.ConnectionState(conn.RemotePeer())
|
||||||
if err == nil && peerConnectionState == peers.PeerConnected {
|
if err == nil && (peerConnectionState == peers.PeerConnected || peerConnectionState == peers.PeerConnecting) {
|
||||||
log.Debug("Peer already connected; not handshaking again")
|
log.WithField("currentState", peerConnectionState).Debug("Peer already active; not handshaking again")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.peers.Add(conn.RemotePeer(), conn.RemoteMultiaddr(), conn.Stat().Direction)
|
s.peers.Add(conn.RemotePeer(), conn.RemoteMultiaddr(), conn.Stat().Direction)
|
||||||
|
Loading…
Reference in New Issue
Block a user