From aaac67e7a8aa22502822a11bbd26d0ad67f977dd Mon Sep 17 00:00:00 2001 From: Corbin Phelps Date: Wed, 27 Jul 2022 08:19:31 -0400 Subject: [PATCH] Don't call OnConnectFailed when failed to connect during shutdown Signed-off-by: Corbin Phelps --- client/wsclient.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/wsclient.go b/client/wsclient.go index 468ec0f4..1ac0de3a 100644 --- a/client/wsclient.go +++ b/client/wsclient.go @@ -121,7 +121,7 @@ func (c *wsClient) tryConnectOnce(ctx context.Context) (err error, retryAfter sh var resp *http.Response conn, resp, err := c.dialer.DialContext(ctx, c.url.String(), c.requestHeader) if err != nil { - if c.common.Callbacks != nil { + if c.common.Callbacks != nil && !c.common.IsStopping() { c.common.Callbacks.OnConnectFailed(err) } if resp != nil {