Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyoshiaki committed Jan 3, 2025
1 parent 2f737ab commit 95dbd1e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 5 additions & 7 deletions packages/ice/src/ice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,22 @@ export class Connection implements IceConnection {
}

async restart() {
this.generation++;

this.localUsername = randomString(4);
this.localPassword = randomString(22);
this.remoteUsername = "";
this.remotePassword = "";
this.checkList = [];
this.localCandidates = [];
this._remoteCandidates = [];
this.remoteCandidatesEnd = false;
this.localCandidatesEnd = false;
this.state = "new";
this.lookup?.close?.();
this.lookup = undefined;
this._remoteCandidates = [];
this.nominated = undefined;
this.nominating = false;
this.checkList = [];
this.checkListDone = false;
this.checkListState = new PQueue<number>();
this.earlyChecks = [];
Expand All @@ -138,8 +140,6 @@ export class Connection implements IceConnection {
this.queryConsentHandle = undefined;
this.promiseGatherCandidates = undefined;

this.generation++;

if (this.options.localPasswordPrefix) {
this.localPassword =
this.options.localPasswordPrefix +
Expand Down Expand Up @@ -909,9 +909,7 @@ export class Connection implements IceConnection {
log(
"failure case",
request.toJSON(),
exc.response
? JSON.stringify(exc.response.toJSON(), null, 2)
: undefined,
exc.response ? JSON.stringify(exc.response.toJSON(), null, 2) : error,
{
localUsername,
remoteUsername,
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/src/stun/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class StunProtocol implements Protocol {
}
return;
}
log("parseMessage", addr, message.toJSON());
// log("parseMessage", addr, message.toJSON());
if (
(message.messageClass === classes.RESPONSE ||
message.messageClass === classes.ERROR) &&
Expand Down
12 changes: 6 additions & 6 deletions packages/ice/src/stun/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export class Transaction {
const res = await this.onResponse.asPromise();
return res;
} catch (error) {
log(
"transaction run failed",
error,
this.protocol.type,
this.request.toJSON(),
);
// log(
// "transaction run failed",
// error,
// this.protocol.type,
// this.request.toJSON(),
// );

throw error;
} finally {
Expand Down

0 comments on commit 95dbd1e

Please sign in to comment.