From c96a371e5ebcea90d1afac6a66c2f4f946e38007 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Thu, 26 Oct 2023 19:11:03 +0530 Subject: [PATCH] removed use of connection serial from the code --- ably/realtime_conn.go | 12 ------------ ably/realtime_conn_integration_test.go | 5 ----- ably/realtime_conn_spec_integration_test.go | 5 ----- 3 files changed, 22 deletions(-) diff --git a/ably/realtime_conn.go b/ably/realtime_conn.go index 0c4f8c0f..186d065d 100644 --- a/ably/realtime_conn.go +++ b/ably/realtime_conn.go @@ -61,10 +61,6 @@ type Connection struct { // a realtime client docs for more info (RTN9). key string - // serial is the serial number of the last message to be received on this connection, used automatically by - // the library when recovering or resuming a connection. When recovering a connection explicitly, the recoveryKey - // is used in the recover client options as it contains both the key and the last message serial (RTN10). - serial *int64 msgSerial int64 connStateTTL durationFromMsecs err error @@ -523,14 +519,6 @@ func (c *Connection) CreateRecoveryKey() string { return recoveryKey } -// Serial gives serial number of a message received most recently. -// Last known serial number is used when recovering connection state. -func (c *Connection) Serial() *int64 { - c.mtx.Lock() - defer c.mtx.Unlock() - return c.serial -} - // State returns current state of the connection. func (c *Connection) State() ConnectionState { c.mtx.Lock() diff --git a/ably/realtime_conn_integration_test.go b/ably/realtime_conn_integration_test.go index 9ed7d145..471ff265 100644 --- a/ably/realtime_conn_integration_test.go +++ b/ably/realtime_conn_integration_test.go @@ -57,11 +57,6 @@ func TestRealtimeConn_NoConnect(t *testing.T) { err := ablytest.Wait(ablytest.ConnWaiter(client, client.Connect, ably.ConnectionEventConnected), nil) assert.NoError(t, err, "Connect()=%v", err) - serial := client.Connection.Serial() - assert.NotNil(t, serial) - assert.Equal(t, int64(-1), *serial, - "want serial=-1; got %d", client.Connection.Serial()) - err = ablytest.FullRealtimeCloser(client).Close() assert.NoError(t, err, "ablytest.FullRealtimeCloser(client).Close()=%v", err) diff --git a/ably/realtime_conn_spec_integration_test.go b/ably/realtime_conn_spec_integration_test.go index d00994ea..40b59676 100644 --- a/ably/realtime_conn_spec_integration_test.go +++ b/ably/realtime_conn_spec_integration_test.go @@ -2034,11 +2034,6 @@ func TestRealtimeConn_RTN16(t *testing.T) { reason := client2.Connection.ErrorReason() assert.Equal(t, 80008, int(reason.Code), "expected 80008 got %d", reason.Code) - serial := client2.Connection.Serial() - assert.NotNil(t, serial) - // verify serial is -1 (new connection), not 5 - assert.Equal(t, int64(-1), *serial, - "expected -1 got %d", serial) msgSerial := client2.Connection.MsgSerial() // verify msgSerial is 0 (new connection), not 3 assert.Equal(t, int64(0), msgSerial,