channelnotifier+discover+invoices: return error in Stop functions

In order to be consistent with other sub systems an error is now
returned from the Stop functions.
This also allows writing a generic cleanup mechanism to stop all
sub systems in case of a failure.
This commit is contained in:
Roei Erez
2019-01-21 13:11:19 +02:00
parent c998264578
commit 3223df74e5
10 changed files with 58 additions and 20 deletions

View File

@@ -49,11 +49,13 @@ func (p *PeerNotifier) Start() error {
}
// Stop signals the notifier for a graceful shutdown.
func (p *PeerNotifier) Stop() {
func (p *PeerNotifier) Stop() error {
var err error
p.stopped.Do(func() {
log.Info("Stopping PeerNotifier")
p.ntfnServer.Stop()
err = p.ntfnServer.Stop()
})
return err
}
// SubscribePeerEvents returns a subscribe.Client that will receive updates