(stream, state, count, cb)
| 697 | } |
| 698 | |
| 699 | function afterWrite(stream, state, count, cb) { |
| 700 | state[kState] &= ~kAfterWritePending; |
| 701 | |
| 702 | const needDrain = (state[kState] & (kEnding | kNeedDrain | kDestroyed)) === kNeedDrain && state.length === 0; |
| 703 | if (needDrain) { |
| 704 | state[kState] &= ~kNeedDrain; |
| 705 | stream.emit('drain'); |
| 706 | } |
| 707 | |
| 708 | while (count-- > 0) { |
| 709 | state.pendingcb--; |
| 710 | cb(null); |
| 711 | } |
| 712 | |
| 713 | if ((state[kState] & kDestroyed) !== 0) { |
| 714 | errorBuffer(state); |
| 715 | } |
| 716 | |
| 717 | if ((state[kState] & kEnding) !== 0) { |
| 718 | finishMaybe(stream, state, true); |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | // If there's something in the buffer waiting, then invoke callbacks. |
| 723 | function errorBuffer(state) { |
no test coverage detected