()
| 6663 | |
| 6664 | var cleanedUp = false; |
| 6665 | function cleanup() { |
| 6666 | debug('cleanup'); |
| 6667 | // cleanup event handlers once the pipe is broken |
| 6668 | dest.removeListener('close', onclose); |
| 6669 | dest.removeListener('finish', onfinish); |
| 6670 | dest.removeListener('drain', ondrain); |
| 6671 | dest.removeListener('error', onerror); |
| 6672 | dest.removeListener('unpipe', onunpipe); |
| 6673 | src.removeListener('end', onend); |
| 6674 | src.removeListener('end', unpipe); |
| 6675 | src.removeListener('data', ondata); |
| 6676 | |
| 6677 | cleanedUp = true; |
| 6678 | |
| 6679 | // if the reader is waiting for a drain event from this |
| 6680 | // specific writer, then it would cause it to never start |
| 6681 | // flowing again. |
| 6682 | // So, if this is awaiting a drain, then we just call it now. |
| 6683 | // If we don't know, then assume that we are waiting for one. |
| 6684 | if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); |
| 6685 | } |
| 6686 | |
| 6687 | // If the user pushes more data while we're writing to dest then we'll end up |
| 6688 | // in ondata again. However, we only want to increase awaitDrain once because |
no test coverage detected
searching dependent graphs…