Skip to content

Commit 624e485

Browse files
committed
peerNotFound stats
1 parent 5480a5b commit 624e485

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

.github/workflows/docker-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
push: true
3737
platforms: linux/amd64
3838
# tags: cdnbye/cbsignal_uws:latest
39-
tags: cdnbye/cbsignal_uws:5.5.0
39+
tags: cdnbye/cbsignal_uws:5.5.1

lib/hub.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class Hub {
1414
this.logger = logger;
1515
this.numClientAllWorkers = 0;
1616
this.numWorkers = 0;
17+
this.stats = {
18+
notFoundCount: 0,
19+
total: 1,
20+
};
1721
setInterval(() => {
1822
this.checkConns();
1923
}, CHECK_CLIENT_INTERVAL * 1000 + randomNum(0, 10000))
@@ -238,6 +242,7 @@ class Hub {
238242
if (data.candidate && !data.candidate.candidate) {
239243
return
240244
}
245+
this.stats.total ++;
241246
if (target) {
242247
const success = this.sendJsonToClient(target, this._processJson(json, peerId, target.isCompact));
243248
if (!success) {
@@ -288,6 +293,7 @@ class Hub {
288293

289294
async _handlePeerNotFound(client, toPeerId, peerId) {
290295
// this.logger.info(`_handlePeerNotFound ${client} ${toPeerId} ${peerId}`);
296+
this.stats.notFoundCount ++;
291297
const msg = {
292298
action: 'signal',
293299
from_peer_id: toPeerId,
@@ -335,9 +341,13 @@ class Hub {
335341
// if (wsCountRemoved > 0 || httpCountRemoved > 0) {
336342
// this.logger.warn(`check cmap finished, closed clients: ws ${wsCountRemoved} polling ${httpCountRemoved}`);
337343
// }
338-
this.logger.warn(`current clients ws ${wsCount}, polling ${httpCount}, hit cache ${((redis.stats.curCount/redis.stats.totalCount)*100).toFixed(2)}%`);
344+
this.logger.warn(`current clients ws ${wsCount}, polling ${httpCount}, hit cache ${((redis.stats.curCount/redis.stats.totalCount)*100).toFixed(2)}%, peerNotFound ${((this.stats.notFoundCount/this.stats.total)*100).toFixed(2)}%`);
339345
redis.stats.curCount = 0;
340346
redis.stats.totalCount = 1;
347+
this.stats = {
348+
notFoundCount: 0,
349+
total: 1,
350+
}
341351
}
342352
}
343353

lib/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class Server {
349349
(this.access.denyDomains?.has(domain) ||
350350
this.access.allowDomains?.has(domain) === false);
351351
if (shouldDeny) {
352-
this.logger.warn(`denied domain ${domain}`);
352+
// this.logger.warn(`denied domain ${domain}`);
353353
ws.end(4000, 'domain is denied');
354354
return
355355
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cbsignal_uws",
3-
"version": "5.5.0",
3+
"version": "5.5.1",
44
"description": "SwarmCloud signaling server using uWebSockets.js",
55
"main": "index.js",
66
"bin": "index.js",

0 commit comments

Comments
 (0)