mirror of https://github.com/poanetwork/gecko.git
removed weird unlocking behavior in the retry mechanism
This commit is contained in:
parent
db9155ab2a
commit
8a6efcdebe
|
@ -696,8 +696,6 @@ func (n *network) connectTo(ip utils.IPDesc) {
|
||||||
_, isConnected := n.connectedIPs[str]
|
_, isConnected := n.connectedIPs[str]
|
||||||
_, isMyself := n.myIPs[str]
|
_, isMyself := n.myIPs[str]
|
||||||
closed := n.closed
|
closed := n.closed
|
||||||
n.retryDelay[str] = delay
|
|
||||||
n.stateLock.Unlock()
|
|
||||||
|
|
||||||
if !isDisconnected || isConnected || isMyself || closed {
|
if !isDisconnected || isConnected || isMyself || closed {
|
||||||
// If the IP was discovered by the peer connecting to us, we don't
|
// 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
|
// If the network was closed, we should stop attempting to connect
|
||||||
// to the peer
|
// to the peer
|
||||||
|
|
||||||
|
n.stateLock.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
n.retryDelay[str] = delay
|
||||||
|
n.stateLock.Unlock()
|
||||||
|
|
||||||
err := n.attemptConnect(ip)
|
err := n.attemptConnect(ip)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
Loading…
Reference in New Issue