bouncer: disable eose_timeout by default or when unspecified

Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
Yonle
2024-01-29 21:41:52 +07:00
parent a46b56adad
commit 3429f449ad
2 changed files with 6 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ module.exports = (ws, req, onClose) => {
ws.pendingEOSE = new Map(); // each contain subID ws.pendingEOSE = new Map(); // each contain subID
ws.EOSETimeout = new Map(); // per subID ws.EOSETimeout = new Map(); // per subID
ws.reconnectTimeout = new Set(); // relays timeout() before reconnection. Only use after client disconnected. ws.reconnectTimeout = new Set(); // relays timeout() before reconnection. Only use after client disconnected.
//ws.subalias = new Map();
ws.pubkey = null; ws.pubkey = null;
if (authorized_keys?.length) { if (authorized_keys?.length) {
@@ -170,6 +171,7 @@ module.exports = (ws, req, onClose) => {
// CL - Set up EOSE timeout // CL - Set up EOSE timeout
function timeoutEOSE(id, subid) { function timeoutEOSE(id, subid) {
if (!eose_timeout) return;
const c = csess.get(id); const c = csess.get(id);
if (!c) return; if (!c) return;

View File

@@ -56,7 +56,10 @@ module.exports = {
pause_on_limit: false, pause_on_limit: false,
// EOSE timeout in milliseconds // 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. // 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. // Normally, waiting EOSE from 3 relays should be enough. Leaving it with 0 equals wait for every established relays.