Skip to content

Commit 26aadef

Browse files
committed
add observability when dropping/gathering ice candidates
1 parent a571f70 commit 26aadef

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/rpc/signaling-exchange.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,23 +255,38 @@ export class SignalingExchange {
255255
candidate: RTCIceCandidateInit | null;
256256
}) {
257257
await this.remoteDescriptionSet;
258+
258259
if (this.exchangeDone || this.pc.iceConnectionState === 'connected') {
260+
if (event.candidate !== null) {
261+
// eslint-disable-next-line no-console
262+
console.info('Dropping ICE candidate - exchange done or already connected', {
263+
exchangeDone: this.exchangeDone,
264+
iceConnectionState: this.pc.iceConnectionState,
265+
candidate: event.candidate.candidate
266+
});
267+
}
259268
return;
260269
}
261270

262271
if (event.candidate === null) {
272+
// eslint-disable-next-line no-console
273+
console.info('ICE gathering complete');
263274
this.iceComplete = true;
264275
await this.sendDone();
265276
return;
266277
}
267278

268279
if (this.callUuid === undefined || this.callUuid === '') {
280+
// eslint-disable-next-line no-console
281+
console.error(callUUIDUnset);
269282
throw new Error(callUUIDUnset);
270283
}
271284

272285
if (event.candidate.candidate !== undefined) {
273-
console.debug(`gathered local ICE ${event.candidate.candidate}`); // eslint-disable-line no-console
286+
// eslint-disable-next-line no-console
287+
console.info(`gathered local ICE ${event.candidate.candidate}`);
274288
}
289+
275290
const iProto = iceCandidateToProto(event.candidate);
276291
const callRequestUpdate = new CallUpdateRequest({
277292
uuid: this.callUuid,
@@ -280,6 +295,7 @@ export class SignalingExchange {
280295
value: iProto,
281296
},
282297
});
298+
283299
const callUpdateStart = new Date();
284300
try {
285301
await this.signalingClient.callUpdate(callRequestUpdate, this.callOpts);

0 commit comments

Comments
 (0)