From c0151610dc70039e7c6c43629f81e9209ed85bbd Mon Sep 17 00:00:00 2001 From: Benjamin Wenger <ben@elixxir.ioo> Date: Mon, 27 Dec 2021 16:26:34 -0800 Subject: [PATCH] added HasRunningProcessies --- api/client.go | 6 ++++++ bindings/client.go | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/api/client.go b/api/client.go index afb902a2d..1a3840abe 100644 --- a/api/client.go +++ b/api/client.go @@ -526,6 +526,12 @@ func (c *Client) NetworkFollowerStatus() Status { return c.followerServices.status() } +// HasRunningProcessies checks if any background threads are running +// and returns true if one or more are +func (c *Client) HasRunningProcessies() bool { + return c.followerServices.stoppable.IsStopped() +} + // Returns the health tracker for registration and polling func (c *Client) GetHealth() interfaces.HealthTracker { jww.INFO.Printf("GetHealth()") diff --git a/bindings/client.go b/bindings/client.go index 9f2c1b300..47e4b34a3 100644 --- a/bindings/client.go +++ b/bindings/client.go @@ -265,6 +265,15 @@ func (c *Client) WaitForNetwork(timeoutMS int) bool { func (c *Client) NetworkFollowerStatus() int { return int(c.api.NetworkFollowerStatus()) } +// HasRunningProcessies checks if any background threads are running. +// returns true if none are running. This is meant to be +// used when NetworkFollowerStatus() returns Stopping. +// Due to the handling of comms on iOS, where the OS can +// block indefiently, it may not enter the stopped +// state apropreatly. This can be used instead. +func (c *Client) HasRunningProcessies() bool { + return c.api.HasRunningProcessies() +} // returns true if the network is read to be in a healthy state where // messages can be sent -- GitLab