mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 06:02:51 +02:00
server.go: replace call to removePeer with Disconnect in DisconnectPeer
Without this, calls to DisconnectPeer would bypass the peerTerminationWatcher and allow subsequent connect requests to go through before the peer's links were fully shut down. This could lead to force closes.
This commit is contained in:
@ -4217,11 +4217,9 @@ func (s *server) DisconnectPeer(pubKey *btcec.PublicKey) error {
|
||||
delete(s.persistentPeers, pubStr)
|
||||
delete(s.persistentPeersBackoff, pubStr)
|
||||
|
||||
// Remove the current peer from the server's internal state and signal
|
||||
// that the peer termination watcher does not need to execute for this
|
||||
// peer.
|
||||
s.removePeer(peer)
|
||||
s.ignorePeerTermination[peer] = struct{}{}
|
||||
// Remove the peer by calling Disconnect. Previously this was done with
|
||||
// removePeer, which bypassed the peerTerminationWatcher.
|
||||
peer.Disconnect(fmt.Errorf("server: DisconnectPeer called"))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user