mirror of https://codeberg.org/pzp/pzp-sync.git
Stream: put all phases in switch-case
This commit is contained in:
parent
9f25aeeffa
commit
f3a8d805e9
|
@ -248,7 +248,7 @@ class SyncStream extends Pipeable {
|
||||||
|
|
||||||
for (const id of this.#requested) {
|
for (const id of this.#requested) {
|
||||||
if (!this.#canSend()) return
|
if (!this.#canSend()) return
|
||||||
this.#sendLocalHave(id)
|
this.write({ id, phase: 0 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,6 +257,9 @@ class SyncStream extends Pipeable {
|
||||||
const { id, phase, payload } = data
|
const { id, phase, payload } = data
|
||||||
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
|
case 0: {
|
||||||
|
return this.#sendLocalHave(id)
|
||||||
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
return this.#sendLocalHaveAndWant(id, payload)
|
return this.#sendLocalHaveAndWant(id, payload)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue