()
| 413 | } |
| 414 | |
| 415 | consumerReturn() { |
| 416 | if (this.#consumerState !== 'active') return; |
| 417 | this.#consumerState = 'returned'; |
| 418 | this.#cleanup(); |
| 419 | this.#resolvePendingReads(); |
| 420 | this.#rejectPendingWrites( |
| 421 | new ERR_INVALID_STATE.TypeError('Stream closed by consumer')); |
| 422 | // If closing, reject the pending end promise |
| 423 | if (this.#writerState === 'closing' && this.#pendingEnd) { |
| 424 | this.#pendingEnd.reject( |
| 425 | new ERR_INVALID_STATE.TypeError('Stream closed by consumer')); |
| 426 | this.#pendingEnd = null; |
| 427 | } |
| 428 | // Resolve pending drains with false - no more data will be consumed |
| 429 | this.#resolvePendingDrains(false); |
| 430 | } |
| 431 | |
| 432 | consumerThrow(error) { |
| 433 | if (this.#consumerState !== 'active') return; |
no test coverage detected