Skip to content

Commit 7edcc68

Browse files
committed
rpc_proxy: allow Litd's StopDaemon call at any time
1 parent df05f88 commit 7edcc68

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

rpc_proxy.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ func isStatusReq(uri string) bool {
194194
)
195195
}
196196

197+
// isShutdownReq returns true if the given request is a Litd shutdown request.
198+
func isShutdownReq(uri string) bool {
199+
return strings.HasPrefix(
200+
uri, fmt.Sprintf(
201+
"/%s/%s", litrpc.LitService_ServiceDesc.ServiceName,
202+
"StopDaemon",
203+
),
204+
)
205+
}
206+
197207
// Stop shuts down the lnd connection.
198208
func (p *rpcProxy) Stop() error {
199209
p.grpcServer.Stop()
@@ -397,8 +407,9 @@ func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {
397407
system = LitdSubServer
398408

399409
// If the request is for the status server, then we allow the
400-
// request even if Lit has not properly started.
401-
if isStatusReq(requestURI) {
410+
// request even if Lit has not properly started. We also allow
411+
// the request through if it is a Litd shutdown.
412+
if isStatusReq(requestURI) || isShutdownReq(requestURI) {
402413
return nil
403414
}
404415

terminal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ func (g *LightningTerminal) start() error {
576576

577577
case err := <-g.errQueue.ChanOut():
578578
if err != nil {
579-
log.Errorf("Received critical error from subsystem, "+
580-
"shutting down: %v", err)
579+
return fmt.Errorf("received critical error from "+
580+
"subsystem, shutting down: %v", err)
581581
}
582582

583583
case <-lndQuit:

0 commit comments

Comments
 (0)