Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connmgr: Only mark persistent peer reconn pending. #3238

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions connmgr/connmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,19 +379,21 @@ out:
continue
}

// Otherwise, we will attempt a reconnection if
// we do not have enough peers, or if this is a
// persistent peer. The connection request is
// re added to the pending map, so that
// subsequent processing of connections and
// failures do not ignore the request.
if uint32(len(conns)) < cm.cfg.TargetOutbound ||
connReq.Permanent {

connReq.updateState(ConnPending)
log.Debugf("Reconnecting to %v",
connReq)
pending[msg.id] = connReq
// Otherwise, attempt a reconnection when there are not already
// enough outbound peers to satisfy the target number of
// outbound peers or this is a persistent peer.
numConns := uint32(len(conns))
if numConns < cm.cfg.TargetOutbound || connReq.Permanent {
// The connection request is reused for persistent peers, so
// add it back to the pending map in that case so that
// subsequent processing of connections and failures do not
// ignore the request.
if connReq.Permanent {
connReq.updateState(ConnPending)
log.Debugf("Reconnecting to %v", connReq)
pending[msg.id] = connReq
}

cm.handleFailedConn(ctx, connReq)
}

Expand Down
Loading