Resend leaveOpen queries

fixes #594
This commit is contained in:
2023-06-27 10:38:26 +01:00
parent 9f8095b0df
commit 9f114ffb44
3 changed files with 32 additions and 5 deletions

View File

@ -152,6 +152,10 @@ export class Query implements QueryBase {
this.#checkTraces();
}
isOpen() {
return this.#cancelAt === undefined && this.#leaveOpen;
}
canRemove() {
return this.#cancelAt !== undefined && this.#cancelAt < unixNowMs();
}
@ -212,6 +216,17 @@ export class Query implements QueryBase {
this.#tracing.filter(a => a.connId == id).forEach(a => a.forceEose());
}
connectionRestored(c: Connection) {
if (this.isOpen()) {
for (const qt of this.#tracing) {
if (qt.relay === c.Address) {
debugger;
c.QueueReq(["REQ", qt.id, ...qt.filters], () => qt.sentToRelay());
}
}
}
}
sendClose() {
for (const qt of this.#tracing) {
qt.sendClose();
@ -287,7 +302,7 @@ export class Query implements QueryBase {
() => this.#onProgress()
);
this.#tracing.push(qt);
c.QueueReq(["REQ", qt.id, ...q.filters], () => qt.sentToRelay());
c.QueueReq(["REQ", qt.id, ...qt.filters], () => qt.sentToRelay());
return qt;
}
}