From 2437b44db72d60ed05ebca32c7d7f25f29fa4059 Mon Sep 17 00:00:00 2001 From: HF Date: Sat, 18 Mar 2023 14:32:33 +0100 Subject: [PATCH] little inconsistencies --- .eslintrc.json | 1 + src/socket/SocketServer.js | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 32c6a62d..032b4cfd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,6 +28,7 @@ "function-call-argument-newline":"off", "max-len": [1, 80, 2, {"ignoreComments": true}], "no-bitwise": 0, + "no-restricted-syntax": 0, "no-plusplus" : "off", "no-param-reassign": "off", "no-mixed-operators":"off", diff --git a/src/socket/SocketServer.js b/src/socket/SocketServer.js index 46f3342a..4af451e3 100644 --- a/src/socket/SocketServer.js +++ b/src/socket/SocketServer.js @@ -329,9 +329,9 @@ class SocketServer { killAllWsByUerIp(ip) { let amount = ipCounter.get(ip); if (!amount) return 0; - // eslint-disable-next-line + for (const [chunkid, clients] of this.CHUNK_CLIENTS.entries()) { - const newClients = clients.filter((ws) => ws.user.ip === ip); + const newClients = clients.filter((ws) => ws.user.ip !== ip); if (clients.length !== newClients.length) { this.CHUNK_CLIENTS.set(chunkid, newClients); } @@ -650,11 +650,13 @@ class SocketServer { } deleteAllChunks(ws) { - if (!ws.chunkCnt) return; + if (!ws.chunkCnt) { + return; + } if (ws.user.id === 1) { console.log('DEBUG delete all chunk for hf'); } - // eslint-disable-next-line + for (const client of this.CHUNK_CLIENTS.values()) { const pos = client.indexOf(ws); if (~pos) {