From 7a71bcd7790adf91cf78326a9990d702331125d1 Mon Sep 17 00:00:00 2001 From: Yonle Date: Sat, 27 Jan 2024 07:33:15 +0700 Subject: [PATCH] major bugfix: fix sock readyState handler Signed-off-by: Yonle --- bouncer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bouncer.js b/bouncer.js index 94d5ff8..58a8f86 100644 --- a/bouncer.js +++ b/bouncer.js @@ -208,7 +208,7 @@ function direct_bc(msg, id) { for (const sock of socks) { if (cache_relays?.includes(sock.url)) continue; if (sock.id !== id) continue; - if (sock.readyState !== 2) continue; + if (sock.readyState !== 1) continue; // skip the ratelimit after if ((upstream_ratelimit_expiration) > (Date.now() - sock.ratelimit)) continue; @@ -220,7 +220,7 @@ function cache_bc(msg, id) { for (const sock of socks) { if (!cache_relays?.includes(sock.url)) continue; if (sock.id !== id) continue; - if (sock.readyState !== 2) continue; + if (sock.readyState !== 1) continue; sock.send(JSON.stringify(msg)); } }