server: request new peer after disconnection of non-persistent peers

Doing so ensures we reach our target number of outbound peers as soon as
possible. This is only necessary after calls to connmgr.Remove, as these
won't request a new peer connection.
This commit is contained in:
Wilmer Paulino 2019-10-10 13:25:19 -04:00
parent 45d66d46f9
commit 0d00cdf82c
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -1680,6 +1680,7 @@ func (s *server) handleDonePeerMsg(state *peerState, sp *serverPeer) {
s.connManager.Disconnect(sp.connReq.ID())
} else {
s.connManager.Remove(sp.connReq.ID())
go s.connManager.NewConnReq()
}
}
@ -2031,6 +2032,7 @@ func (s *server) outboundPeerConnected(c *connmgr.ConnReq, conn net.Conn) {
s.connManager.Disconnect(c.ID())
} else {
s.connManager.Remove(c.ID())
go s.connManager.NewConnReq()
}
return
}