()
| 86 | } |
| 87 | |
| 88 | async *iterate(): AsyncGenerator<Envelope> { |
| 89 | for (;;) { |
| 90 | if (this.#err) throw this.#err; |
| 91 | if (this.#q.length) { |
| 92 | yield this.#q.shift()!; |
| 93 | continue; |
| 94 | } |
| 95 | if (this.#done) return; |
| 96 | const r = await new Promise<IteratorResult<Envelope>>((res) => { |
| 97 | this.#wait = res; |
| 98 | }); |
| 99 | if (this.#err) throw this.#err; |
| 100 | if (r.done) return; |
| 101 | yield r.value; |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | export class Transport { |