| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cb55c67 commit 1c1af81
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -385,6 +385,7 @@ function onEofChunk(stream, state) { | |||
| 385 | 385 | } | |
| 386 | 386 | } | |
| 387 | 387 | state.ended = true; | |
| 388 | + stream.readable = false; | ||
| 388 | 389 | ||
| 389 | 390 | // emit 'readable' now to make sure it gets picked up. | |
| 390 | 391 | emitReadable(stream); | |
@@ -670,7 +671,7 @@ Readable.prototype.on = function(ev, fn) { | |||
| 670 | 671 | this.resume(); | |
| 671 | 672 | } | |
| 672 | 673 | ||
| 673 | - if (ev === 'readable' && this.readable) { | ||
| 674 | + if (ev === 'readable' && !this._readableState.endEmitted) { | ||
| 674 | 675 | var state = this._readableState; | |
| 675 | 676 | if (!state.readableListening) { | |
| 676 | 677 | state.readableListening = true; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -483,4 +483,5 @@ function endWritable(stream, state, cb) { | |||
| 483 | 483 | stream.once('finish', cb); | |
| 484 | 484 | } | |
| 485 | 485 | state.ended = true; | |
| 486 | + stream.writable = false; | ||
| 486 | 487 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | var common = require('../common'); | |
| 3 | 3 | var R = require('_stream_readable'); | |
| 4 | + var W = require('_stream_writable'); | ||
| 4 | 5 | var assert = require('assert'); | |
| 5 | 6 | ||
| 6 | 7 | var util = require('util'); | |
@@ -29,4 +30,25 @@ var reader = new TestReader(); | |||
| 29 | 30 | setImmediate(function() { | |
| 30 | 31 | assert.equal(ondataCalled, 1); | |
| 31 | 32 | console.log('ok'); | |
| 33 | + reader.push(null); | ||
| 34 | + }); | ||
| 35 | + | ||
| 36 | + function TestWriter() { | ||
| 37 | + W.apply(this); | ||
| 38 | + this.write('foo'); | ||
| 39 | + this.end(); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + util.inherits(TestWriter, W); | ||
| 43 | + | ||
| 44 | + TestWriter.prototype._write = function(chunk, enc, cb) { | ||
| 45 | + cb(); | ||
| 46 | + }; | ||
| 47 | + | ||
| 48 | + var writer = new TestWriter(); | ||
| 49 | + | ||
| 50 | + process.on('exit', function() { | ||
| 51 | + assert.strictEqual(reader.readable, false); | ||
| 52 | + assert.strictEqual(writer.writable, false); | ||
| 53 | + console.log('ok'); | ||
| 32 | 54 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments