Skip to content

Commit

Permalink
removed use of connection serial from the code
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Oct 26, 2023
1 parent ae5720a commit c96a371
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
12 changes: 0 additions & 12 deletions ably/realtime_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 0 additions & 5 deletions ably/realtime_conn_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions ably/realtime_conn_spec_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c96a371

Please sign in to comment.