Skip to content

Commit

Permalink
RSDK-8989 - Always provide error on base channel close (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniels authored Oct 15, 2024
1 parent 59b2ba3 commit 203fecd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/rpc/base-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ export class BaseChannel {
});
}

public close() {
this.closeWithReason(undefined);
}

public isClosed() {
return this.closed;
}
Expand All @@ -52,7 +48,7 @@ export class BaseChannel {
return this.closedReason;
}

protected closeWithReason(err?: Error) {
public closeWithReason(err: Error) {
if (this.closed) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/dial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export const dialWebRTC = async (
if (dialOpts?.dialTimeout !== undefined) {
setTimeout(() => {
if (!successful) {
exchange.terminate();
exchange.terminate(new Error('timed out'));
}
}, dialOpts.dialTimeout);
}
Expand Down
6 changes: 3 additions & 3 deletions src/rpc/signaling-exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class SignalingExchange {
.then(() => {
this.exchangeDone = true;
})
.catch(console.error); // eslint-disable-line no-console
.catch(console.error);

// Initiate now the call now that all of our handlers are setup.
const callResponses = this.signalingClient.call(callRequest, this.callOpts);
Expand Down Expand Up @@ -127,8 +127,8 @@ export class SignalingExchange {
}
}

public terminate() {
this.clientChannel.close();
public terminate(err: Error) {
this.clientChannel.closeWithReason(err);
}

private async processCallResponses(
Expand Down

0 comments on commit 203fecd

Please sign in to comment.