Skip to content

Commit

Permalink
syncer: always allow manual peer connections
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Sep 1, 2024
1 parent 70443a4 commit 1767a28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,11 @@ func (s *Syncer) peerLoop(ctx context.Context) error {
for _, p := range candidates {
if numOutbound() >= s.config.MaxOutboundPeers {
break
} else if err := s.allowConnect(ctx, p, false); err != nil {
log.Debug("rejected outbound peer", zap.String("peer", p), zap.Error(err))
break
}

ctx, cancel := context.WithTimeout(ctx, s.config.ConnectTimeout)
if _, err := s.Connect(ctx, p); err != nil {
log.Debug("connected to peer", zap.String("peer", p))
Expand Down Expand Up @@ -684,10 +688,6 @@ func (s *Syncer) Close() error {

// Connect forms an outbound connection to a peer.
func (s *Syncer) Connect(ctx context.Context, addr string) (*Peer, error) {
if err := s.allowConnect(ctx, addr, false); err != nil {
return nil, err
}

conn, err := (&net.Dialer{}).DialContext(ctx, "tcp", addr)
if err != nil {
return nil, err
Expand Down

0 comments on commit 1767a28

Please sign in to comment.