File tree 1 file changed +3
-24
lines changed
1 file changed +3
-24
lines changed Original file line number Diff line number Diff line change @@ -47,38 +47,17 @@ function Duplex(options) {
47
47
if ( options && options . allowHalfOpen === false )
48
48
this . allowHalfOpen = false ;
49
49
50
- this . once ( 'finish' , onfinish ) ;
51
50
this . once ( 'end' , onend ) ;
52
51
}
53
52
54
- // the no-half-open enforcers.
55
- function onfinish ( ) {
56
- // if we allow half-open state, or if the readable side ended,
57
- // then we're ok.
58
- if ( this . allowHalfOpen || this . _readableState . ended )
59
- return ;
60
-
61
- // mark that we're done.
62
- this . _readableState . ended = true ;
63
-
64
- // tell the user
65
- if ( this . _readableState . length === 0 )
66
- this . emit ( 'end' ) ;
67
- else
68
- this . emit ( 'readable' ) ;
69
- }
70
-
53
+ // the no-half-open enforcer
71
54
function onend ( ) {
72
55
// if we allow half-open state, or if the writable side ended,
73
56
// then we're ok.
74
57
if ( this . allowHalfOpen || this . _writableState . ended )
75
58
return ;
76
59
77
- // just in case the user is about to call write() again.
78
- this . write = function ( ) {
79
- return false ;
80
- } ;
81
-
82
60
// no more data can be written.
83
- this . end ( ) ;
61
+ // But allow more writes to happen in this tick.
62
+ process . nextTick ( this . end . bind ( this ) ) ;
84
63
}
You can’t perform that action at this time.
0 commit comments