| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 17319e7 commit 1e3e6da
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -377,17 +377,9 @@ function howMuchToRead(n, state) { | |||
| 377 | 377 | else | |
| 378 | 378 | return state.length; | |
| 379 | 379 | } | |
| 380 | - // If we're asking for more than the current hwm, then raise the hwm. | ||
| 381 | - if (n > state.highWaterMark) | ||
| 382 | - state.highWaterMark = computeNewHighWaterMark(n); | ||
| 383 | 380 | if (n <= state.length) | |
| 384 | 381 | return n; | |
| 385 | - // Don't have enough | ||
| 386 | - if (!state.ended) { | ||
| 387 | - state.needReadable = true; | ||
| 388 | - return 0; | ||
| 389 | - } | ||
| 390 | - return state.length; | ||
| 382 | + return state.ended ? state.length : 0; | ||
| 391 | 383 | } | |
| 392 | 384 | ||
| 393 | 385 | // You can override either this method, or the async _read(n) below. | |
@@ -403,6 +395,10 @@ Readable.prototype.read = function(n) { | |||
| 403 | 395 | const state = this._readableState; | |
| 404 | 396 | const nOrig = n; | |
| 405 | 397 | ||
| 398 | + // If we're asking for more than the current hwm, then raise the hwm. | ||
| 399 | + if (n > state.highWaterMark) | ||
| 400 | + state.highWaterMark = computeNewHighWaterMark(n); | ||
| 401 | + | ||
| 406 | 402 | if (n !== 0) | |
| 407 | 403 | state.emittedReadable = false; | |
| 408 | 404 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments