removed weird unlocking behavior in the retry mechanism

This commit is contained in:
StephenButtolph 2020-05-30 16:59:01 -04:00
parent db9155ab2a
commit 8a6efcdebe
1 changed files with 4 additions and 2 deletions

View File

@ -696,8 +696,6 @@ func (n *network) connectTo(ip utils.IPDesc) {
_, isConnected := n.connectedIPs[str]
_, isMyself := n.myIPs[str]
closed := n.closed
n.retryDelay[str] = delay
n.stateLock.Unlock()
if !isDisconnected || isConnected || isMyself || closed {
// If the IP was discovered by the peer connecting to us, we don't
@ -708,8 +706,12 @@ func (n *network) connectTo(ip utils.IPDesc) {
// If the network was closed, we should stop attempting to connect
// to the peer
n.stateLock.Unlock()
return
}
n.retryDelay[str] = delay
n.stateLock.Unlock()
err := n.attemptConnect(ip)
if err == nil {