mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
server: within peerTerminationWatcher exit early if daemon is exiting
This commit is contained in:
parent
cd7b3290a8
commit
34bb0ec36f
16
server.go
16
server.go
@ -336,8 +336,8 @@ func (s *server) Start() error {
|
||||
s.wg.Add(1)
|
||||
go s.queryHandler()
|
||||
|
||||
// With all the relevant sub-systems started, we'll now atetmpt to
|
||||
// stasblish persistent connections to our direct channel collaborators
|
||||
// With all the relevant sub-systems started, we'll now attempt to
|
||||
// establish persistent connections to our direct channel collaborators
|
||||
// within the network.
|
||||
if err := s.establishPersistentConnections(); err != nil {
|
||||
return err
|
||||
@ -610,9 +610,21 @@ func (s *server) peerTerminationWatcher(p *peer) {
|
||||
|
||||
srvrLog.Debugf("Peer %v has been disconnected", p)
|
||||
|
||||
// If the server is exiting then we can bail out early ourselves as all
|
||||
// the other sub-systems will already be shutting down.
|
||||
select {
|
||||
case <-s.quit:
|
||||
return
|
||||
default:
|
||||
// If we aren't shutting down, then we'll fall through this
|
||||
// this empty default case.
|
||||
}
|
||||
|
||||
// Tell the switch to remove all links associated with this peer.
|
||||
// Passing nil as the target link indicates that all links associated
|
||||
// with this interface should be closed.
|
||||
//
|
||||
// TODO(roasbeef): instead add a PurgeInterfaceLinks function?
|
||||
links, err := p.server.htlcSwitch.GetLinksByInterface(p.pubKeyBytes)
|
||||
if err != nil {
|
||||
srvrLog.Errorf("unable to get channel links: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user