From: Matt Joiner Date: Thu, 8 Feb 2018 12:57:53 +0000 (+1100) Subject: Expose Client.Closed X-Git-Tag: v1.0.0~189 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=924b916b2a5537953b67f7db07fd9d4b62661ea8;p=btrtrc.git Expose Client.Closed --- diff --git a/client.go b/client.go index 5ae32af6..47bd03d8 100644 --- a/client.go +++ b/client.go @@ -368,6 +368,12 @@ func firstNonEmptyString(ss ...string) string { return "" } +func (cl *Client) Closed() <-chan struct{} { + cl.mu.Lock() + defer cl.mu.Unlock() + return cl.closed.C() +} + // Stops the client. All connections to peers are closed and all activity will // come to a halt. func (cl *Client) Close() {