terminal: add missing stop of pool daemon

We forgot to shut down the pool server cleanly when terminating LiT.
While we touch this section of the code we might also shorten it a bit
by using the one line assignment/if construct.
This commit is contained in:
Oliver Gugger 2021-02-16 13:39:33 +01:00
parent 6e1803bdee
commit 1b003817b5
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -423,8 +423,7 @@ func (g *LightningTerminal) shutdown() error {
var returnErr error
if g.faradayStarted {
err := g.faradayServer.Stop()
if err != nil {
if err := g.faradayServer.Stop(); err != nil {
log.Errorf("Error stopping faraday: %v", err)
returnErr = err
}
@ -432,13 +431,19 @@ func (g *LightningTerminal) shutdown() error {
if g.loopStarted {
g.loopServer.Stop()
err := <-g.loopServer.ErrChan
if err != nil {
if err := <-g.loopServer.ErrChan; err != nil {
log.Errorf("Error stopping loop: %v", err)
returnErr = err
}
}
if g.poolStarted {
if err := g.poolServer.Stop(); err != nil {
log.Errorf("Error stopping pool: %v", err)
returnErr = err
}
}
if g.lndClient != nil {
g.lndClient.Close()
}