From 800a6c092a0ca93be8f65db6e1274ab605baeb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Thu, 18 Jan 2024 23:00:29 +0100 Subject: [PATCH] refactor: use waitGroup() instead of wg in client --- client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index ac55e34..edcfa00 100644 --- a/client.go +++ b/client.go @@ -168,9 +168,9 @@ type client struct { func (c *client) Start() { c.setState(ClientConnecting) boff := c.backoffFactory() - c.wg.Add(1) + c.partyBase.waitGroup().Add(1) go func() { - defer c.wg.Done() + defer c.partyBase.waitGroup().Done() for { c.setErr(nil) // Listen for state change to ClientConnected and signal backoff Reset then. @@ -223,7 +223,7 @@ func (c *client) Start() { func (c *client) Stop() { if c.cancelFunc != nil { c.cancelFunc() - c.wg.Wait() + c.partyBase.waitGroup().Wait() c.setState(ClientClosed) } }