mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-17 13:06:14 +02:00
mobile: Add ServiceStatus for retrieving current runtime status of lnd
Used for checking whether lnd is started or not. ServiceStatus can also be used to determine when lnd has shut down, since `stopDaemon` returns immediately and does not wait for the gRPC servers to be fully closed.
This commit is contained in:
parent
14a01eb84f
commit
aca307f05f
1 changed files with 15 additions and 0 deletions
|
|
@ -156,3 +156,18 @@ func Start(extraArgs string, rpcReady Callback) {
|
|||
rpcReady.OnResponse([]byte{})
|
||||
}()
|
||||
}
|
||||
|
||||
type LndStatusCallback interface {
|
||||
OnResponse(lndStarted int32)
|
||||
}
|
||||
|
||||
// ServiceStatus returns 1 if lnd has started up successfully, allowing the
|
||||
// caller to interact with the in-memory gRPC servers. If 0 is returned, the
|
||||
// caller should invoke `Start` to initialize lnd.
|
||||
//
|
||||
// ServiceStatus can also be used to determine when lnd has shut down, since
|
||||
// `stopDaemon` returns immediately and does not wait for the gRPC servers to be
|
||||
// fully closed.
|
||||
func ServiceStatus(callback LndStatusCallback) {
|
||||
callback.OnResponse(atomic.LoadInt32(&lndStarted))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue