(stream)
| 1422 | // Waits for the stream's drain callback to fire, indicating the |
| 1423 | // outbound has capacity for more data. |
| 1424 | function waitForDrain(stream) { |
| 1425 | const { promise, resolve } = PromiseWithResolvers(); |
| 1426 | const prevDrain = stream[kDrain]; |
| 1427 | stream[kDrain] = () => { |
| 1428 | stream[kDrain] = prevDrain; |
| 1429 | resolve(); |
| 1430 | }; |
| 1431 | return promise; |
| 1432 | } |
| 1433 | |
| 1434 | // Writes a batch to the handle, awaiting drain if backpressured. |
| 1435 | // Returns true if the stream was destroyed during the wait. |
no test coverage detected