Skip to content

Commit

Permalink
Only log client connect failed when no handler is added
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Apr 16, 2022
1 parent b67db9b commit f6fa9cd
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions dist/nkn.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ class Client {

_connectFailed() {
if (!this.isFailed) {
console.log('Client connect failed');
this.isFailed = true;

if (this.eventListeners.connectFailed.length > 0) {
Expand All @@ -194,6 +193,8 @@ class Client {
console.log('Connect failed handler error:', e);
}
});
} else {
console.log('Client connect failed');
}
}
}
Expand Down Expand Up @@ -10439,7 +10440,6 @@ class MultiClient {
}));

_promise.default.all(connectFailedPromises).then(() => {
console.log('All clients connect failed');
this.isFailed = true;

if (this.eventListeners.connectFailed.length > 0) {
Expand All @@ -10450,6 +10450,8 @@ class MultiClient {
console.log('Connect failed handler error:', e);
}
});
} else {
console.log('All clients connect failed');
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion dist/nkn.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class Client {

_connectFailed() {
if (!this.isFailed) {
console.log('Client connect failed');
this.isFailed = true;

if (this.eventListeners.connectFailed.length > 0) {
Expand All @@ -193,6 +192,8 @@ class Client {
console.log('Connect failed handler error:', e);
}
});
} else {
console.log('Client connect failed');
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/multiclient/multiclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ class MultiClient {
}));

_promise.default.all(connectFailedPromises).then(() => {
console.log('All clients connect failed');
this.isFailed = true;

if (this.eventListeners.connectFailed.length > 0) {
Expand All @@ -282,6 +281,8 @@ class MultiClient {
console.log('Connect failed handler error:', e);
}
});
} else {
console.log('All clients connect failed');
}
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export default class Client {

_connectFailed() {
if (!this.isFailed) {
console.log('Client connect failed');
this.isFailed = true;
if (this.eventListeners.connectFailed.length > 0) {
this.eventListeners.connectFailed.forEach(async f => {
Expand All @@ -175,6 +174,8 @@ export default class Client {
console.log('Connect failed handler error:', e);
}
});
} else {
console.log('Client connect failed');
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/multiclient/multiclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ export default class MultiClient {
this.clients[clientID].onConnectFailed(resolve);
}));
Promise.all(connectFailedPromises).then(() => {
console.log('All clients connect failed');
this.isFailed = true;
if (this.eventListeners.connectFailed.length > 0) {
this.eventListeners.connectFailed.forEach(async f => {
Expand All @@ -253,6 +252,8 @@ export default class MultiClient {
console.log('Connect failed handler error:', e);
}
});
} else {
console.log('All clients connect failed');
}
});
}
Expand Down

0 comments on commit f6fa9cd

Please sign in to comment.