Skip to content

Commit 203fecd

Browse files
authored
RSDK-8989 - Always provide error on base channel close (#391)
1 parent 59b2ba3 commit 203fecd

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/rpc/base-channel.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ export class BaseChannel {
4040
});
4141
}
4242

43-
public close() {
44-
this.closeWithReason(undefined);
45-
}
46-
4743
public isClosed() {
4844
return this.closed;
4945
}
@@ -52,7 +48,7 @@ export class BaseChannel {
5248
return this.closedReason;
5349
}
5450

55-
protected closeWithReason(err?: Error) {
51+
public closeWithReason(err: Error) {
5652
if (this.closed) {
5753
return;
5854
}

src/rpc/dial.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ export const dialWebRTC = async (
402402
if (dialOpts?.dialTimeout !== undefined) {
403403
setTimeout(() => {
404404
if (!successful) {
405-
exchange.terminate();
405+
exchange.terminate(new Error('timed out'));
406406
}
407407
}, dialOpts.dialTimeout);
408408
}

src/rpc/signaling-exchange.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class SignalingExchange {
7373
.then(() => {
7474
this.exchangeDone = true;
7575
})
76-
.catch(console.error); // eslint-disable-line no-console
76+
.catch(console.error);
7777

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

130-
public terminate() {
131-
this.clientChannel.close();
130+
public terminate(err: Error) {
131+
this.clientChannel.closeWithReason(err);
132132
}
133133

134134
private async processCallResponses(

0 commit comments

Comments
 (0)