@@ -99,9 +99,6 @@ function ReadableState(options, stream, isDuplex) {
9999 this . endEmitted = false ;
100100 this . reading = false ;
101101
102- // Flipped if an 'error' is emitted.
103- this . errorEmitted = false ;
104-
105102 // a flag to be able to tell if the event 'readable'/'data' is emitted
106103 // immediately, or on a later tick. We set this to true at first, because
107104 // any actions that shouldn't happen until "later" should generally also
@@ -1072,23 +1069,20 @@ function fromList(n, state) {
10721069function endReadable ( stream ) {
10731070 var state = stream . _readableState ;
10741071
1075- debug ( 'endReadable' , state . endEmitted , state . errorEmitted ) ;
1076- if ( ! state . endEmitted && ! state . errorEmitted ) {
1072+ debug ( 'endReadable' , state . endEmitted ) ;
1073+ if ( ! state . endEmitted ) {
10771074 state . ended = true ;
10781075 process . nextTick ( endReadableNT , state , stream ) ;
10791076 }
10801077}
10811078
10821079function endReadableNT ( state , stream ) {
1083- debug ( 'endReadableNT' , state . endEmitted , state . length , state . errorEmitted ) ;
1080+ debug ( 'endReadableNT' , state . endEmitted , state . length ) ;
10841081
10851082 // Check that we didn't get one last unshift.
10861083 if ( ! state . endEmitted && state . length === 0 ) {
1084+ state . endEmitted = true ;
10871085 stream . readable = false ;
1088-
1089- if ( ! state . errorEmitted ) {
1090- state . endEmitted = true ;
1091- stream . emit ( 'end' ) ;
1092- }
1086+ stream . emit ( 'end' ) ;
10931087 }
10941088}
0 commit comments