multi: add shutdown logs in subservers

This commit adds a simple shutdown to every subserver to assist
debugging.
This commit is contained in:
yyforyongyu 2021-09-02 20:26:00 +08:00
parent 03bce2129b
commit 3204e2d74b
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
15 changed files with 24 additions and 6 deletions

View File

@ -118,6 +118,8 @@ func (b *BitcoindNotifier) Stop() error {
return nil
}
chainntnfs.Log.Info("bitcoind notifier shutting down")
// Shutdown the rpc client, this gracefully disconnects from bitcoind,
// and cleans up all related resources.
b.chainConn.Stop()

View File

@ -161,6 +161,8 @@ func (b *BtcdNotifier) Stop() error {
return nil
}
chainntnfs.Log.Info("btcd notifier shutting down")
// Shutdown the rpc client, this gracefully disconnects from btcd, and
// cleans up all related resources.
b.chainConn.Shutdown()

View File

@ -136,6 +136,8 @@ func (n *NeutrinoNotifier) Stop() error {
return nil
}
chainntnfs.Log.Info("neutrino notifier shutting down")
close(n.quit)
n.wg.Wait()

View File

@ -97,6 +97,7 @@ func (c *ChannelNotifier) Start() error {
func (c *ChannelNotifier) Stop() error {
var err error
c.stopped.Do(func() {
log.Info("ChannelNotifier shutting down")
err = c.ntfnServer.Stop()
})
return err

View File

@ -893,7 +893,7 @@ func (c *ChainArbitrator) Stop() error {
return nil
}
log.Infof("Stopping ChainArbitrator")
log.Info("ChainArbitrator shutting down")
close(c.quit)

View File

@ -467,7 +467,10 @@ func (d *AuthenticatedGossiper) start() error {
// Stop signals any active goroutines for a graceful closure.
func (d *AuthenticatedGossiper) Stop() error {
d.stopped.Do(d.stop)
d.stopped.Do(func() {
log.Info("Authenticated gossiper shutting down")
d.stop()
})
return nil
}

View File

@ -137,6 +137,9 @@ func (p *OnionProcessor) Start() error {
// Stop shutsdown the onion processor's sphinx router.
func (p *OnionProcessor) Stop() error {
log.Info("Onion processor shutting down")
p.router.Stop()
return nil
}

View File

@ -91,6 +91,7 @@ func (h *HtlcNotifier) Start() error {
func (h *HtlcNotifier) Stop() error {
var err error
h.stopped.Do(func() {
log.Info("HtlcNotifier shutting down")
if err = h.ntfnServer.Stop(); err != nil {
log.Warnf("error stopping htlc notifier: %v", err)
}

View File

@ -1942,7 +1942,7 @@ func (s *Switch) Stop() error {
return errors.New("htlc switch already shutdown")
}
log.Infof("HTLC Switch shutting down")
log.Info("HTLC Switch shutting down")
close(s.quit)

View File

@ -257,6 +257,8 @@ func (i *InvoiceRegistry) Start() error {
// Stop signals the registry for a graceful shutdown.
func (i *InvoiceRegistry) Stop() error {
log.Info("InvoiceRegistry shutting down")
i.expiryWatcher.Stop()
close(i.quit)

View File

@ -217,6 +217,7 @@ func (m *ChanStatusManager) start() error {
// Stop safely shuts down the ChanStatusManager.
func (m *ChanStatusManager) Stop() error {
m.stopped.Do(func() {
log.Info("Channel Status Manager shutting down")
close(m.quit)
m.wg.Wait()
})

View File

@ -68,6 +68,7 @@ func (h *HostAnnouncer) Start() error {
// Stop signals the HostAnnouncer for a graceful stop.
func (h *HostAnnouncer) Stop() error {
h.stopOnce.Do(func() {
log.Info("HostAnnouncer shutting down")
close(h.quit)
h.wg.Wait()
})

View File

@ -52,7 +52,7 @@ func (p *PeerNotifier) Start() error {
func (p *PeerNotifier) Stop() error {
var err error
p.stopped.Do(func() {
log.Info("Stopping PeerNotifier")
log.Info("PeerNotifier shutting down")
err = p.ntfnServer.Stop()
})
return err

View File

@ -691,7 +691,7 @@ func (r *ChannelRouter) Stop() error {
return nil
}
log.Tracef("Channel Router shutting down")
log.Info("Channel Router shutting down")
// Our filtered chain view could've only been started if
// AssumeChannelValid isn't present.

View File

@ -427,7 +427,7 @@ func (s *UtxoSweeper) Stop() error {
return nil
}
log.Debugf("Sweeper shutting down")
log.Info("Sweeper shutting down")
close(s.quit)
s.wg.Wait()