Skip to content

Commit

Permalink
should also consider disconnected case with disconnecting case
Browse files Browse the repository at this point in the history
  • Loading branch information
wcsiu committed Mar 31, 2024
1 parent 65bb896 commit f024744
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client.go
Expand Up @@ -516,7 +516,7 @@ func (c *client) internalConnLost(whyConnLost error) {
DEBUG.Println(CLI, "internalConnLost called")
disDone, err := c.status.ConnectionLost(c.options.AutoReconnect && c.status.ConnectionStatus() > connecting)
if err != nil {
if err == errConnLossWhileDisconnecting {
if errors.Is(err, errConnLossWhileDisconnecting) || errors.Is(err, errAlreadyDisconnected) {
return // Loss of connection is expected or already being handled
}
ERROR.Println(CLI, fmt.Sprintf("internalConnLost unexpected status: %s", err.Error()))
Expand Down
2 changes: 1 addition & 1 deletion status.go
Expand Up @@ -169,7 +169,7 @@ func (c *connectionStatus) connected(success bool) error {
}()

// Status may have moved to disconnecting in the interim (i.e. at users request)
if c.status == disconnecting {
if c.status == disconnecting || c.status == disconnected {
return errAbortConnection
}
if success {
Expand Down

0 comments on commit f024744

Please sign in to comment.