-
-
Save Raynos/180ed4fa7ba12a521ec4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -367,8 +371,10 @@ Readable.prototype.pipe = function(dest, pipeOpts) { | |
// specific writer, then it would cause it to never start | |
// flowing again. | |
// So, if this is awaiting a drain, then we just call it now. | |
- // If we don't know, then assume that we are waiting for one. | |
- if (!dest._writableState || dest._writableState.needDrain) | |
+ // If we don't know, then assume that we are not | |
+ // waiting for one. If we don't know it's the writer's | |
+ // responsibility to manage drain state. | |
+ if (dest._writableState && dest._writableState.needDrain) | |
ondrain(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -496,6 +502,7 @@ Readable.prototype.unpipe = function(dest) { | |
state.pipes = null; | |
state.pipesCount = 0; | |
this.removeListener('readable', pipeOnReadable); | |
+ state.flowing = false; | |
if (dest) | |
dest.emit('unpipe', this); | |
return this; | |
@@ -510,6 +517,7 @@ Readable.prototype.unpipe = function(dest) { | |
state.pipes = null; | |
state.pipesCount = 0; | |
this.removeListener('readable', pipeOnReadable); | |
+ state.flowing = false; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment