@@ -472,21 +472,11 @@ function onStreamReady(streamHandle, id, push_id) {
472
472
// state because new streams should not have been accepted at the C++
473
473
// level.
474
474
assert ( ! session . closing ) ;
475
-
476
- // TODO(@jasnell): Get default options from session
477
- const uni = id & 0b10 ;
478
- const {
479
- highWaterMark,
480
- defaultEncoding,
481
- } = session [ kStreamOptions ] ;
482
475
const stream = new QuicStream ( {
483
- writable : ! uni ,
484
- highWaterMark,
485
- defaultEncoding,
476
+ ...session [ kStreamOptions ] ,
477
+ writable : ! ( id & 0b10 ) ,
486
478
} , session , push_id ) ;
487
479
stream [ kSetHandle ] ( streamHandle ) ;
488
- if ( uni )
489
- stream . end ( ) ;
490
480
session [ kAddStream ] ( id , stream ) ;
491
481
process . nextTick ( emit . bind ( session , 'stream' , stream ) ) ;
492
482
}
@@ -2145,12 +2135,6 @@ class QuicSession extends EventEmitter {
2145
2135
readable : ! halfOpen
2146
2136
} , this ) ;
2147
2137
2148
- // TODO(@jasnell): This really shouldn't be necessary
2149
- if ( halfOpen ) {
2150
- stream . push ( null ) ;
2151
- stream . read ( ) ;
2152
- }
2153
-
2154
2138
state . pendingStreams . add ( stream ) ;
2155
2139
2156
2140
// If early data is being used, we can create the internal QuicStream on the
@@ -2516,7 +2500,7 @@ class QuicClientSession extends QuicSession {
2516
2500
}
2517
2501
2518
2502
function streamOnResume ( ) {
2519
- if ( ! this . destroyed )
2503
+ if ( ! this . destroyed && this . readable )
2520
2504
this [ kHandle ] . readStart ( ) ;
2521
2505
}
2522
2506
@@ -2546,9 +2530,13 @@ class QuicStream extends Duplex {
2546
2530
const {
2547
2531
highWaterMark,
2548
2532
defaultEncoding,
2533
+ readable = true ,
2534
+ writable = true ,
2549
2535
} = options ;
2550
2536
2551
2537
super ( {
2538
+ readable,
2539
+ writable,
2552
2540
highWaterMark,
2553
2541
defaultEncoding,
2554
2542
allowHalfOpen : true ,
@@ -2996,10 +2984,6 @@ class QuicStream extends Duplex {
2996
2984
defaultEncoding,
2997
2985
} , this . session ) ;
2998
2986
2999
- // TODO(@jasnell): The null push and subsequent read shouldn't be necessary
3000
- stream . push ( null ) ;
3001
- stream . read ( ) ;
3002
-
3003
2987
stream [ kSetHandle ] ( handle ) ;
3004
2988
this . session [ kAddStream ] ( stream . id , stream ) ;
3005
2989
return stream ;
0 commit comments