mirror of https://codeberg.org/pzp/pzp-sync.git
Handle missing remoteWants without throwing
This commit is contained in:
parent
c6d142dd0c
commit
5797116a87
|
@ -260,8 +260,7 @@ class SyncStream extends Pipeable {
|
||||||
async #sendBloomReq(id, phase, round, remoteBloom, msgIDsForMe) {
|
async #sendBloomReq(id, phase, round, remoteBloom, msgIDsForMe) {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
this.#debug('%s Stream IN%s: got bloom round %s plus msgIDs in %s: %o', this.#myId, phase-1, round-1, id, msgIDsForMe)
|
this.#debug('%s Stream IN%s: got bloom round %s plus msgIDs in %s: %o', this.#myId, phase-1, round-1, id, msgIDsForMe)
|
||||||
const remoteWantRange = this.#remoteWant.get(id)
|
const remoteWantRange = this.#remoteWant.get(id) ?? [0, 0]
|
||||||
if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`)
|
|
||||||
this.#updateReceivableMsgs(id, msgIDsForMe)
|
this.#updateReceivableMsgs(id, msgIDsForMe)
|
||||||
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
||||||
id,
|
id,
|
||||||
|
@ -293,8 +292,7 @@ class SyncStream extends Pipeable {
|
||||||
async #sendBloomRes(id, phase, round, remoteBloom, msgIDsForMe) {
|
async #sendBloomRes(id, phase, round, remoteBloom, msgIDsForMe) {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
this.#debug('%s Stream IN%s: got bloom round %s plus msgIDs in %s: %o', this.#myId, phase-1, round, id, msgIDsForMe)
|
this.#debug('%s Stream IN%s: got bloom round %s plus msgIDs in %s: %o', this.#myId, phase-1, round, id, msgIDsForMe)
|
||||||
const remoteWantRange = this.#remoteWant.get(id)
|
const remoteWantRange = this.#remoteWant.get(id) ?? [0, 0]
|
||||||
if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`)
|
|
||||||
this.#updateReceivableMsgs(id, msgIDsForMe)
|
this.#updateReceivableMsgs(id, msgIDsForMe)
|
||||||
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
||||||
id,
|
id,
|
||||||
|
@ -325,8 +323,7 @@ class SyncStream extends Pipeable {
|
||||||
async #sendMissingMsgsReq(id, round, remoteBloom, msgIDsForMe) {
|
async #sendMissingMsgsReq(id, round, remoteBloom, msgIDsForMe) {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
this.#debug('%s Stream IN7: got bloom round %s plus msgIDs in %s: %o', this.#myId, round, id, msgIDsForMe)
|
this.#debug('%s Stream IN7: got bloom round %s plus msgIDs in %s: %o', this.#myId, round, id, msgIDsForMe)
|
||||||
const remoteWantRange = this.#remoteWant.get(id)
|
const remoteWantRange = this.#remoteWant.get(id) ?? [0, 0]
|
||||||
if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`)
|
|
||||||
this.#updateReceivableMsgs(id, msgIDsForMe)
|
this.#updateReceivableMsgs(id, msgIDsForMe)
|
||||||
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
||||||
id,
|
id,
|
||||||
|
@ -364,8 +361,7 @@ class SyncStream extends Pipeable {
|
||||||
async #sendMissingMsgsRes(id, round, remoteBloom, msgsForMe) {
|
async #sendMissingMsgsRes(id, round, remoteBloom, msgsForMe) {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
this.#debug('%s Stream IN8: got bloom round %s plus %s msgs in %s', this.#myId, round, msgsForMe.length, id)
|
this.#debug('%s Stream IN8: got bloom round %s plus %s msgs in %s', this.#myId, round, msgsForMe.length, id)
|
||||||
const remoteWantRange = this.#remoteWant.get(id)
|
const remoteWantRange = this.#remoteWant.get(id) ?? [0, 0]
|
||||||
if (!remoteWantRange) throw new Error(`Remote want-range not set for ${id}`)
|
|
||||||
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
const msgIDsForThem = await this.#algo.getMsgsMissing(
|
||||||
id,
|
id,
|
||||||
round,
|
round,
|
||||||
|
|
Loading…
Reference in New Issue