Skip to content

Commit

Permalink
conn: remove connectionSerial
Browse files Browse the repository at this point in the history
  • Loading branch information
andydunstall committed Aug 24, 2022
1 parent 1510e89 commit 45b1b73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
2 changes: 0 additions & 2 deletions src/common/lib/client/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class Connection extends EventEmitter {
state: string;
key?: string;
id?: string;
serial: undefined;
errorReason: ErrorInfo | null;

constructor(ably: Realtime, options: NormalisedClientOptions) {
Expand All @@ -26,7 +25,6 @@ class Connection extends EventEmitter {
this.state = this.connectionManager.state.state;
this.key = undefined;
this.id = undefined;
this.serial = undefined;
this.errorReason = null;

this.connectionManager.on('connectionstate', (stateChange: ConnectionStateChange) => {
Expand Down
19 changes: 3 additions & 16 deletions src/common/lib/transport/connectionmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export class TransportParams {
mode: string;
format?: Utils.Format;
connectionKey?: string;
connectionSerial?: number;
stream?: any;
heartbeats?: boolean;

Expand All @@ -99,8 +98,6 @@ export class TransportParams {
this.mode = mode;
this.connectionKey = connectionKey;
this.format = options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json;

this.connectionSerial = undefined;
}

getConnectParams(authParams: Record<string, unknown>): Record<string, string> {
Expand Down Expand Up @@ -153,9 +150,6 @@ export class TransportParams {
if (this.connectionKey) {
result += ',connectionKey=' + this.connectionKey;
}
if (this.connectionSerial !== undefined) {
result += ',connectionSerial=' + this.connectionSerial;
}
if (this.format) {
result += ',format=' + this.format;
}
Expand Down Expand Up @@ -237,7 +231,6 @@ class ConnectionManager extends EventEmitter {
connectionDetails?: Record<string, any>;
connectionId?: string;
connectionKey?: string;
connectionSerial?: number;
connectionStateTtl: number;
maxIdleInterval: number | null;
transports: string[];
Expand Down Expand Up @@ -336,7 +329,6 @@ class ConnectionManager extends EventEmitter {
this.connectionDetails = undefined;
this.connectionId = undefined;
this.connectionKey = undefined;
this.connectionSerial = undefined;
this.connectionStateTtl = timeouts.connectionStateTtl;
this.maxIdleInterval = null;

Expand Down Expand Up @@ -442,11 +434,7 @@ class ConnectionManager extends EventEmitter {
}

createTransportParams(host: string | null, mode: string): TransportParams {
const params = new TransportParams(this.options, host, mode, this.connectionKey);
if (this.connectionSerial !== undefined) {
params.connectionSerial = this.connectionSerial;
}
return params;
return new TransportParams(this.options, host, mode, this.connectionKey);
}

getTransportParams(callback: Function): void {
Expand Down Expand Up @@ -1107,8 +1095,7 @@ class ConnectionManager extends EventEmitter {
): void {
/* if connectionKey changes but connectionId stays the same, then just a
* transport change on the same connection. If connectionId changes, we're
* on a new connection, with implications for msgSerial and channel state,
* and resetting the connectionSerial position */
* on a new connection, with implications for msgSerial and channel state */
/* If no previous connectionId, don't reset the msgSerial as it may have
* been set by recover data (unless the recover failed) */
const prevConnId = this.connectionId,
Expand Down Expand Up @@ -2061,7 +2048,7 @@ class ConnectionManager extends EventEmitter {
Logger.logAction(
Logger.LOG_ERROR,
'ConnectionManager.onChannelMessage()',
'received message with different connectionSerial, but same message id as a previous; discarding; id = ' +
'received message with the same message id as a previous; discarding; id = ' +
message.id
);
return;
Expand Down

0 comments on commit 45b1b73

Please sign in to comment.