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

+9 -1
View File
@@ -1862,6 +1862,14 @@ func (r *rpcServer) GetNetworkInfo(context.Context, *lnrpc.NetworkInfoRequest) (
}, nil
}
// StopDaemon will send a shutdown request to the interrupt handler, triggering
// a graceful shutdown of the daemon.
func (r *rpcServer) StopDaemon(context.Context, *lnrpc.StopRequest) (*lnrpc.StopResponse, error) {
shutdownRequestChannel <- struct{}{}
return &lnrpc.StopResponse{}, nil
}
// SubscribeChannelGraph launches a streaming RPC that allows the caller to
// receive notifications upon any changes the channel graph topology from the
// review of the responding node. Events notified include: new nodes coming
@@ -1894,7 +1902,7 @@ func (r *rpcServer) SubscribeChannelGraph(req *lnrpc.GraphTopologySubscription,
// or the notification client was cancelled. So we'll
// exit early.
if !ok {
return errors.New("sever shutting down")
return errors.New("server shutting down")
}
// Convert the struct from the channel router into the