Skip to content

Commit

Permalink
Clean OutConnectingList and PeerSyncAddress after retry failed. (DNAP…
Browse files Browse the repository at this point in the history
…roject#383)


Signed-off-by: XiaoJie Guo <[email protected]>
  • Loading branch information
XiaoJie Guo authored and laizy committed Jun 25, 2018
1 parent cd9f1d9 commit b1275c9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions p2pserver/p2pserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,22 @@ func (this *P2PServer) retryInactivePeer() {
if v < common.MAX_RETRY_COUNT {
list[addr] = v
}
if v >= common.MAX_RETRY_COUNT {
this.network.RemoveFromConnectingList(addr)
remotePeer := this.network.GetPeerFromAddr(addr)
if remotePeer != nil {
if remotePeer.SyncLink.GetAddr() == addr {
this.network.RemovePeerSyncAddress(addr)
this.network.RemovePeerConsAddress(addr)
}
if remotePeer.ConsLink.GetAddr() == addr {
this.network.RemovePeerConsAddress(addr)
}
this.network.DelNbrNode(remotePeer.GetID())
}
}
}

this.RetryAddrs = list
this.ReconnectAddrs.Unlock()
for _, addr := range addrs {
Expand Down

0 comments on commit b1275c9

Please sign in to comment.