()
| 966 | |
| 967 | let cleanedUp = false; |
| 968 | function cleanup() { |
| 969 | debug('cleanup'); |
| 970 | // Cleanup event handlers once the pipe is broken. |
| 971 | dest.removeListener('close', onclose); |
| 972 | dest.removeListener('finish', onfinish); |
| 973 | if (ondrain) { |
| 974 | dest.removeListener('drain', ondrain); |
| 975 | } |
| 976 | dest.removeListener('error', onerror); |
| 977 | dest.removeListener('unpipe', onunpipe); |
| 978 | src.removeListener('end', onend); |
| 979 | src.removeListener('end', unpipe); |
| 980 | src.removeListener('data', ondata); |
| 981 | |
| 982 | cleanedUp = true; |
| 983 | |
| 984 | // If the reader is waiting for a drain event from this |
| 985 | // specific writer, then it would cause it to never start |
| 986 | // flowing again. |
| 987 | // So, if this is awaiting a drain, then we just call it now. |
| 988 | // If we don't know, then assume that we are waiting for one. |
| 989 | if (ondrain && state.awaitDrainWriters && |
| 990 | (!dest._writableState || dest._writableState.needDrain)) |
| 991 | ondrain(); |
| 992 | } |
| 993 | |
| 994 | function pause() { |
| 995 | // If the user unpiped during `dest.write()`, it is possible |
no test coverage detected
searching dependent graphs…