From 3429f449ad4eef85924d0ee3ae1e37a86663e276 Mon Sep 17 00:00:00 2001 From: Yonle Date: Mon, 29 Jan 2024 21:41:52 +0700 Subject: [PATCH] bouncer: disable eose_timeout by default or when unspecified Signed-off-by: Yonle --- bouncer.js | 2 ++ config.js.example | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bouncer.js b/bouncer.js index 34a4986..4d68674 100644 --- a/bouncer.js +++ b/bouncer.js @@ -35,6 +35,7 @@ module.exports = (ws, req, onClose) => { ws.pendingEOSE = new Map(); // each contain subID ws.EOSETimeout = new Map(); // per subID ws.reconnectTimeout = new Set(); // relays timeout() before reconnection. Only use after client disconnected. + //ws.subalias = new Map(); ws.pubkey = null; if (authorized_keys?.length) { @@ -170,6 +171,7 @@ module.exports = (ws, req, onClose) => { // CL - Set up EOSE timeout function timeoutEOSE(id, subid) { + if (!eose_timeout) return; const c = csess.get(id); if (!c) return; diff --git a/config.js.example b/config.js.example index b30db32..159710f 100644 --- a/config.js.example +++ b/config.js.example @@ -56,7 +56,10 @@ module.exports = { pause_on_limit: false, // EOSE timeout in milliseconds - eose_timeout: 2300, + // Setting as 0 will disable this feature. + // + // Enabling this may make CPU usage to be intensive + eose_timeout: 0, // Maximum of received EOSE from relays to send EOSE to client. // Normally, waiting EOSE from 3 relays should be enough. Leaving it with 0 equals wait for every established relays.