mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-15 18:13:36 +02:00
peer+server: ensure the remote TCP connection is always closed
This commit is contained in:
@@ -518,9 +518,14 @@ func (s *server) removePeer(p *peer) {
|
||||
return
|
||||
}
|
||||
|
||||
// As the peer is now finished, ensure that the TCP connection is
|
||||
// closed and all of its related goroutines have exited.
|
||||
if err := p.Stop(); err != nil {
|
||||
peerLog.Errorf("unable to stop peer: %v", err)
|
||||
}
|
||||
|
||||
// Ignore deleting peers if we're shutting down.
|
||||
if atomic.LoadInt32(&s.shutdown) != 0 {
|
||||
p.Stop()
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user