| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 13d173f commit 322bc6f
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -473,9 +473,10 @@ Readable.prototype.read = function(n) { | |||
| 473 | 473 | debug('length less than watermark', doRead); | |
| 474 | 474 | } | |
| 475 | 475 | ||
| 476 | - // However, if we've ended, then there's no point, and if we're already | ||
| 477 | - // reading, then it's unnecessary. | ||
| 478 | - if (state.ended || state.reading) { | ||
| 476 | + // However, if we've ended, then there's no point, if we're already | ||
| 477 | + // reading, then it's unnecessary, and if we're destroyed, then it's | ||
| 478 | + // not allowed. | ||
| 479 | + if (state.ended || state.reading || state.destroyed) { | ||
| 479 | 480 | doRead = false; | |
| 480 | 481 | debug('reading or ended', doRead); | |
| 481 | 482 | } else if (doRead) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,9 +137,6 @@ ReadStream.prototype._read = function(n) { | |||
| 137 | 137 | }); | |
| 138 | 138 | } | |
| 139 | 139 | ||
| 140 | - if (this.destroyed) | ||
| 141 | - return; | ||
| 142 | - | ||
| 143 | 140 | if (!pool || pool.length - pool.used < kMinPoolSpace) { | |
| 144 | 141 | // Discard the old pool. | |
| 145 | 142 | allocNewPool(this.readableHighWaterMark); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -189,3 +189,12 @@ const assert = require('assert'); | |||
| 189 | 189 | read.push('hi'); | |
| 190 | 190 | read.on('data', common.mustNotCall()); | |
| 191 | 191 | } | |
| 192 | + | ||
| 193 | + { | ||
| 194 | + const read = new Readable({ | ||
| 195 | + read: common.mustNotCall(function() {}) | ||
| 196 | + }); | ||
| 197 | + read.destroy(); | ||
| 198 | + assert.strictEqual(read.destroyed, true); | ||
| 199 | + read.read(); | ||
| 200 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ process.once('uncaughtException', common.mustCall((err) => { | |||
| 10 | 10 | })); | |
| 11 | 11 | ||
| 12 | 12 | const socket = new JSStreamWrap(new Duplex({ | |
| 13 | - read: common.mustCall(), | ||
| 13 | + read: common.mustNotCall(), | ||
| 14 | 14 | write: common.mustCall((buffer, data, cb) => { | |
| 15 | 15 | throw new Error('exception!'); | |
| 16 | 16 | }) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments