mirror of
https://github.com/Yonle/bostr.git
synced 2025-10-09 16:12:48 +02:00
several bug fixes (by ryogrid #7)
* condition of if statement at line 119 seems to wrong * Original code can't check size of client.pendingEOSE.get(data[1]) collectly * Replaced clearInterval to clearTimeout. canceling function for timer which is created by setTimeout is clearTimeout
This commit is contained in:
@@ -116,7 +116,7 @@ module.exports = (ws, req) => {
|
|||||||
terminate_subs(ws.id);
|
terminate_subs(ws.id);
|
||||||
|
|
||||||
for (i of ws.reconnectTimeout) {
|
for (i of ws.reconnectTimeout) {
|
||||||
clearInterval(i);
|
clearTimeout(i);
|
||||||
// Let the garbage collector do the thing. No need to add ws.reconnectTimeout.delete(i);
|
// Let the garbage collector do the thing. No need to add ws.reconnectTimeout.delete(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -271,7 +271,7 @@ function newConn(addr, id) {
|
|||||||
if (process.env.LOG_ABOUT_RELAYS || log_about_relays) console.log(process.pid, "---", `[${id}]`, `got EOSE from ${relay.url} for ${data[1]}. There are ${client.pendingEOSE.get(data[1])} EOSE received out of ${Array.from(socks).filter(sock => sock.id === id).length} connected relays.`);
|
if (process.env.LOG_ABOUT_RELAYS || log_about_relays) console.log(process.pid, "---", `[${id}]`, `got EOSE from ${relay.url} for ${data[1]}. There are ${client.pendingEOSE.get(data[1])} EOSE received out of ${Array.from(socks).filter(sock => sock.id === id).length} connected relays.`);
|
||||||
|
|
||||||
if (!cache_relays?.includes(relay.url)) {
|
if (!cache_relays?.includes(relay.url)) {
|
||||||
if (wait_eose && (client.pendingEOSE.get(data[1]) < (max_eose_score || Array.from(socks).filter(sock => sock.id === id).length))) return;
|
if (wait_eose && ((client.pendingEOSE.get(data[1]) < max_eose_score) || (client.pendingEOSE.get(data[1]) < Array.from(socks).filter(sock => sock.id === id).length))) return;
|
||||||
if (client.pause_subs.has(data[1])) return client.pause_subs.delete(data[1]);
|
if (client.pause_subs.has(data[1])) return client.pause_subs.delete(data[1]);
|
||||||
|
|
||||||
cancel_EOSETimeout(data[1]);
|
cancel_EOSETimeout(data[1]);
|
||||||
|
Reference in New Issue
Block a user