diff --git a/client.go b/client.go index 19b809a..e22090a 100644 --- a/client.go +++ b/client.go @@ -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 || err == errAlreadyHandlingConnectionLoss { + if err == errConnLossWhileDisconnecting { return // Loss of connection is expected or already being handled } ERROR.Println(CLI, fmt.Sprintf("internalConnLost unexpected status: %s", err.Error())) diff --git a/status.go b/status.go index d25fbf5..e3ab138 100644 --- a/status.go +++ b/status.go @@ -67,9 +67,11 @@ func (s status) String() string { } } -type connCompletedFn func(success bool) error -type disconnectCompletedFn func() -type connectionLostHandledFn func(bool) (connCompletedFn, error) +type ( + connCompletedFn func(success bool) error + disconnectCompletedFn func() + connectionLostHandledFn func(bool) (connCompletedFn, error) +) /* State transitions @@ -105,7 +107,6 @@ var ( errAlreadyDisconnected = errors.New("status is already disconnected") errDisconnectionRequested = errors.New("disconnection was requested whilst the action was in progress") errDisconnectionInProgress = errors.New("disconnection already in progress") - errAlreadyHandlingConnectionLoss = errors.New("status is already Connection Lost") errConnLossWhileDisconnecting = errors.New("connection status is disconnecting so loss of connection is expected") )