diff --git a/changelog.md b/changelog.md index 7c29f97..d813b21 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +v0.9.3 +====== + +* Fix leaking connection when getting `token expired` error upon connect. + v0.9.2 ====== diff --git a/client.go b/client.go index dfa2598..93af882 100644 --- a/client.go +++ b/client.go @@ -968,6 +968,7 @@ func (c *Client) startReconnecting() error { c.mu.Unlock() if err != nil { c.handleError(ConnectError{err}) + _ = t.Close() if isTokenExpiredError(err) { c.mu.Lock() defer c.mu.Unlock() @@ -991,7 +992,6 @@ func (c *Client) startReconnecting() error { c.mu.Lock() defer c.mu.Unlock() if c.state != StateConnecting { - _ = t.Close() return } c.reconnectAttempts++