File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -383,17 +383,9 @@ function howMuchToRead(n, state) {
383383 else
384384 return state . length ;
385385 }
386- // If we're asking for more than the current hwm, then raise the hwm.
387- if ( n > state . highWaterMark )
388- state . highWaterMark = computeNewHighWaterMark ( n ) ;
389386 if ( n <= state . length )
390387 return n ;
391- // Don't have enough
392- if ( ! state . ended ) {
393- state . needReadable = true ;
394- return 0 ;
395- }
396- return state . length ;
388+ return state . ended ? state . length : 0 ;
397389}
398390
399391// You can override either this method, or the async _read(n) below.
@@ -409,6 +401,10 @@ Readable.prototype.read = function(n) {
409401 const state = this . _readableState ;
410402 const nOrig = n ;
411403
404+ // If we're asking for more than the current hwm, then raise the hwm.
405+ if ( n > state . highWaterMark )
406+ state . highWaterMark = computeNewHighWaterMark ( n ) ;
407+
412408 if ( n !== 0 )
413409 state . emittedReadable = false ;
414410
You can’t perform that action at this time.
0 commit comments