diff --git a/ably/realtime_conn.go b/ably/realtime_conn.go index 4c146034..8c862132 100644 --- a/ably/realtime_conn.go +++ b/ably/realtime_conn.go @@ -755,7 +755,7 @@ func (c *Connection) eventloop() { c.mtx.Unlock() return } - // RTN23a + // RTN23a, RTN15a c.lockSetState(ConnectionStateDisconnected, err, 0) c.mtx.Unlock() arg := connArgs{ @@ -871,7 +871,7 @@ func (c *Connection) eventloop() { return } // RTN15h2, RTN22a - c.setState(ConnectionStateConnecting, newErrorFromProto(msg.Error), 0) + c.setState(ConnectionStateDisconnected, newErrorFromProto(msg.Error), 0) c.reauthorize(connArgs{ lastActivityAt: lastActivityAt, connDetails: connDetails, @@ -879,7 +879,7 @@ func (c *Connection) eventloop() { return } // RTN15h3 - c.setState(ConnectionStateConnecting, newErrorFromProto(msg.Error), 0) + c.setState(ConnectionStateDisconnected, newErrorFromProto(msg.Error), 0) c.reconnect(connArgs{ lastActivityAt: lastActivityAt, connDetails: connDetails, diff --git a/ably/realtime_conn_spec_integration_test.go b/ably/realtime_conn_spec_integration_test.go index 9ab38666..45a35479 100644 --- a/ably/realtime_conn_spec_integration_test.go +++ b/ably/realtime_conn_spec_integration_test.go @@ -175,7 +175,6 @@ func Test_RTN4a_ConnectionEventForStateChange(t *testing.T) { "fake disconnection failed: %v", err) ablytest.Soon.Recv(t, nil, changes, t.Fatalf) - }) t.Run(fmt.Sprintf("on %s", ably.ConnectionStateSuspended), func(t *testing.T) { @@ -1772,7 +1771,7 @@ func TestRealtimeConn_RTN15h3_Success(t *testing.T) { ablytest.Instantly.Recv(t, &change, stateChanges, t.Fatalf) assert.Equal(t, ably.ConnectionEventConnected, change.Event, - "expected UPDATED event; got %v", change) + "expected CONNECTED event; got %v", change) // Expect no further events.break ablytest.Instantly.NoRecv(t, nil, stateChanges, t.Fatalf) @@ -1805,7 +1804,7 @@ func TestRealtimeConn_RTN15h_Integration_ClientInitiatedAuth(t *testing.T) { assert.NoError(t, err) for i := 0; i < 3; i++ { - err = ablytest.Wait(ablytest.ConnWaiter(realtime, nil, ably.ConnectionEventConnecting), nil) + err = ablytest.Wait(ablytest.ConnWaiter(realtime, nil, ably.ConnectionEventDisconnected), nil) var errorInfo *ably.ErrorInfo assert.Error(t, err) assert.ErrorAs(t, err, &errorInfo)