lnrpc+rpc+lnd: add new Stop command for gracefully shutting down lnd

This commit adds simple non-blocking stop command to lncli, with an
appropriate proto update and implementation within the rpcserver.  When
invoked the interrupt handler routine in signal.go with begin the graceful
shutdown of lnd.
This commit is contained in:
halseth authored and Olaoluwa Osuntokun committed 2017-05-11 14:55:56 -07:00
1 parent 2a602b6d61
commit aa4e166539
7 files changed
+422 -312

No files matched your search

+20
View File
@@ -1550,3 +1550,23 @@ func listChainTxns(ctx *cli.Context) error {
printRespJSON(resp)
return nil
}
var stopCommand = cli.Command{
Name: "stop",
Usage: "Stop and shutdown the daemon.",
Description: "Gracefully stop all daemon subsystems before stopping the daemon itself. This is equivalent to stopping it using CTRL-C.",
Action: stopDaemon,
}
func stopDaemon(ctx *cli.Context) error {
ctxb := context.Background()
client, cleanUp := getClient(ctx)
defer cleanUp()
_, err := client.StopDaemon(ctxb, &lnrpc.StopRequest{})
if err != nil {
return err
}
return nil
}
+1
View File
@@ -79,6 +79,7 @@ func main() {
debugLevelCommand,
decodePayReqComamnd,
listChainTxnsCommand,
stopCommand,
}
if err := app.Run(os.Args); err != nil {