diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 4805369ad..53bfd38c2 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -750,8 +750,8 @@ func (d *AuthenticatedGossiper) Stop() error { } func (d *AuthenticatedGossiper) stop() { - log.Info("Authenticated Gossiper is stopping") - defer log.Info("Authenticated Gossiper stopped") + log.Debug("Authenticated Gossiper is stopping") + defer log.Debug("Authenticated Gossiper stopped") d.blockEpochs.Cancel() diff --git a/htlcswitch/decayedlog.go b/htlcswitch/decayedlog.go index 026c6d641..ca7e19e7d 100644 --- a/htlcswitch/decayedlog.go +++ b/htlcswitch/decayedlog.go @@ -149,6 +149,9 @@ func (d *DecayedLog) initBuckets() error { // Stop halts the garbage collector and closes boltdb. func (d *DecayedLog) Stop() error { + log.Debugf("DecayedLog shutting down...") + defer log.Debugf("DecayedLog shutdown complete") + if !atomic.CompareAndSwapInt32(&d.stopped, 0, 1) { return nil } diff --git a/routing/chainview/bitcoind.go b/routing/chainview/bitcoind.go index 337f18262..56e30c24a 100644 --- a/routing/chainview/bitcoind.go +++ b/routing/chainview/bitcoind.go @@ -125,6 +125,9 @@ func (b *BitcoindFilteredChainView) Start() error { // // NOTE: This is part of the FilteredChainView interface. func (b *BitcoindFilteredChainView) Stop() error { + log.Debug("BitcoindFilteredChainView stopping") + defer log.Debug("BitcoindFilteredChainView stopped") + // Already shutting down? if atomic.AddInt32(&b.stopped, 1) != 1 { return nil @@ -136,8 +139,6 @@ func (b *BitcoindFilteredChainView) Stop() error { b.blockQueue.Stop() - log.Infof("FilteredChainView stopping") - close(b.quit) b.wg.Wait() diff --git a/routing/chainview/btcd.go b/routing/chainview/btcd.go index 876940693..54c2ee4db 100644 --- a/routing/chainview/btcd.go +++ b/routing/chainview/btcd.go @@ -135,6 +135,9 @@ func (b *BtcdFilteredChainView) Start() error { // // NOTE: This is part of the FilteredChainView interface. func (b *BtcdFilteredChainView) Stop() error { + log.Debug("BtcdFilteredChainView stopping") + defer log.Debug("BtcdFilteredChainView stopped") + // Already shutting down? if atomic.AddInt32(&b.stopped, 1) != 1 { return nil @@ -146,8 +149,6 @@ func (b *BtcdFilteredChainView) Stop() error { b.blockQueue.Stop() - log.Infof("FilteredChainView stopping") - close(b.quit) b.wg.Wait() diff --git a/routing/chainview/neutrino.go b/routing/chainview/neutrino.go index 6134cf991..21f04ae95 100644 --- a/routing/chainview/neutrino.go +++ b/routing/chainview/neutrino.go @@ -135,13 +135,14 @@ func (c *CfFilteredChainView) Start() error { // // NOTE: This is part of the FilteredChainView interface. func (c *CfFilteredChainView) Stop() error { + log.Debug("CfFilteredChainView stopping") + defer log.Debug("CfFilteredChainView stopped") + // Already shutting down? if atomic.AddInt32(&c.stopped, 1) != 1 { return nil } - log.Infof("FilteredChainView stopping") - close(c.quit) c.blockQueue.Stop() c.wg.Wait() diff --git a/routing/missioncontrol_store.go b/routing/missioncontrol_store.go index e149e8545..e07a46136 100644 --- a/routing/missioncontrol_store.go +++ b/routing/missioncontrol_store.go @@ -303,7 +303,11 @@ func (b *missionControlStore) run() { // channel needs to be drained appropriately. This could happen // if the flushInterval is very small (e.g. 1 nanosecond). if !timer.Stop() { - <-timer.C + select { + case <-timer.C: + case <-b.done: + log.Debugf("Stopping mission control store") + } } for { @@ -335,7 +339,12 @@ func (b *missionControlStore) run() { case <-b.done: // Release the timer's resources. if !timer.Stop() { - <-timer.C + select { + case <-timer.C: + case <-b.done: + log.Debugf("Mission control " + + "store stopped") + } } return }