prevent a relay from eoseing then closing and causing pool handlers to fire twice.
This commit is contained in:
parent
174d36a440
commit
97bded8f5b
|
@ -84,6 +84,7 @@ export class AbstractSimplePool {
|
|||
// batch all EOSEs into a single
|
||||
const eosesReceived: boolean[] = []
|
||||
let handleEose = (i: number) => {
|
||||
if (eosesReceived[i]) return // do not act twice for the same relay
|
||||
eosesReceived[i] = true
|
||||
if (eosesReceived.filter(a => a).length === relaysLength) {
|
||||
params.oneose?.()
|
||||
|
@ -93,6 +94,7 @@ export class AbstractSimplePool {
|
|||
// batch all closes into a single
|
||||
const closesReceived: string[] = []
|
||||
let handleClose = (i: number, reason: string) => {
|
||||
if (closesReceived[i]) return // do not act twice for the same relay
|
||||
handleEose(i)
|
||||
closesReceived[i] = reason
|
||||
if (closesReceived.filter(a => a).length === relaysLength) {
|
||||
|
|
Loading…
Reference in New Issue