From b75f22a10595e2703ad8da2b7631f743672179e7 Mon Sep 17 00:00:00 2001 From: Yonle Date: Sun, 18 Feb 2024 19:55:51 +0700 Subject: [PATCH] bouncer: rehandling on forwarding ws.my_events Signed-off-by: Yonle --- bouncer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bouncer.js b/bouncer.js index ba484ef..2b0071c 100644 --- a/bouncer.js +++ b/bouncer.js @@ -78,15 +78,15 @@ module.exports = (ws, req, onClose) => { return ws.send(JSON.stringify(["OK", data[1]?.id, false, "rate-limited: request too fast."])); } + lastEvent = Date.now(); + ws.my_events.add(data[1]); + if (!ws.relays.size && !sessStarted) { console.log(process.pid, `>>>`, `${ws.ip} executed ${data[0]} command for the first. Initializing session`); newsess(ws); sessStarted = true; } - lastEvent = Date.now(); - - ws.my_events.add(data[1]); bc(data, ws); ws.send(JSON.stringify(["OK", data[1]?.id, true, ""])); break;