From a46b56adad445100110e04726b114de762505b60 Mon Sep 17 00:00:00 2001 From: Yonle Date: Mon, 29 Jan 2024 21:36:20 +0700 Subject: [PATCH] bouncer: close an already opened subscription Signed-off-by: Yonle --- bouncer.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bouncer.js b/bouncer.js index 6efd8f3..34a4986 100644 --- a/bouncer.js +++ b/bouncer.js @@ -91,10 +91,7 @@ module.exports = (ws, req, onClose) => { if (typeof(data[1]) !== "string") return ws.send(JSON.stringify(["NOTICE", "error: expected subID a string. but got the otherwise."])); if (typeof(data[2]) !== "object") return ws.send(JSON.stringify(["CLOSED", data[1], "error: expected filter to be obj, instead gives the otherwise."])); if ((max_client_subs !== -1) && (ws.subs.size > max_client_subs)) return ws.send(JSON.stringify(["CLOSED", data[1], "rate-limited: too many subscriptions."])); - if (ws.subs.has(data[1])) { - direct_bc(["CLOSE", data[1]], ws.id); - cache_bc(["CLOSE", data[1]], ws.id); - } + if (ws.subs.has(data[1])) return ws.send(JSON.stringify(["CLOSED", data[1], "duplicate: subscription already opened"])); ws.subs.set(data[1], data.slice(2)); ws.events.set(data[1], new Set()); ws.pause_subs.delete(data[1]);