@@ -43,6 +43,7 @@ class QUICConnection extends EventTarget {
43
43
public streamMap : Map < StreamId , QUICStream > = new Map ( ) ;
44
44
protected reasonToCode : StreamReasonToCode ;
45
45
protected codeToReason : StreamCodeToReason ;
46
+ protected maxReadableStreamBytes : number | undefined ;
46
47
protected destroyingMap : Map < StreamId , QUICStream > = new Map ( ) ;
47
48
48
49
// This basically allows one to await this promise
@@ -102,6 +103,7 @@ class QUICConnection extends EventTarget {
102
103
reasonToCode = ( ) => 0 ,
103
104
codeToReason = ( type , code ) =>
104
105
new Error ( `${ type . toString ( ) } ${ code . toString ( ) } ` ) ,
106
+ maxReadableStreamBytes,
105
107
logger = new Logger ( `${ this . name } ${ scid } ` ) ,
106
108
} : {
107
109
scid : QUICConnectionId ;
@@ -110,6 +112,7 @@ class QUICConnection extends EventTarget {
110
112
config : QUICConfig ;
111
113
reasonToCode ?: StreamReasonToCode ;
112
114
codeToReason ?: StreamCodeToReason ;
115
+ maxReadableStreamBytes ?: number ;
113
116
logger ?: Logger ;
114
117
} ) {
115
118
logger . info ( `Connect ${ this . name } ` ) ;
@@ -139,6 +142,7 @@ class QUICConnection extends EventTarget {
139
142
remoteInfo,
140
143
reasonToCode,
141
144
codeToReason,
145
+ maxReadableStreamBytes,
142
146
logger,
143
147
} ) ;
144
148
socket . connectionMap . set ( connection . connectionId , connection ) ;
@@ -158,6 +162,7 @@ class QUICConnection extends EventTarget {
158
162
reasonToCode = ( ) => 0 ,
159
163
codeToReason = ( type , code ) =>
160
164
new Error ( `${ type . toString ( ) } ${ code . toString ( ) } ` ) ,
165
+ maxReadableStreamBytes,
161
166
logger = new Logger ( `${ this . name } ${ scid } ` ) ,
162
167
} : {
163
168
scid : QUICConnectionId ;
@@ -167,6 +172,7 @@ class QUICConnection extends EventTarget {
167
172
config : QUICConfig ;
168
173
reasonToCode ?: StreamReasonToCode ;
169
174
codeToReason ?: StreamCodeToReason ;
175
+ maxReadableStreamBytes ?: number ;
170
176
logger ?: Logger ;
171
177
} ) : Promise < QUICConnection > {
172
178
logger . info ( `Accept ${ this . name } ` ) ;
@@ -196,6 +202,7 @@ class QUICConnection extends EventTarget {
196
202
remoteInfo,
197
203
reasonToCode,
198
204
codeToReason,
205
+ maxReadableStreamBytes,
199
206
logger,
200
207
} ) ;
201
208
socket . connectionMap . set ( connection . connectionId , connection ) ;
@@ -211,6 +218,7 @@ class QUICConnection extends EventTarget {
211
218
remoteInfo,
212
219
reasonToCode,
213
220
codeToReason,
221
+ maxReadableStreamBytes,
214
222
logger,
215
223
} : {
216
224
type : 'client' | 'server' ;
@@ -220,6 +228,7 @@ class QUICConnection extends EventTarget {
220
228
remoteInfo : RemoteInfo ;
221
229
reasonToCode : StreamReasonToCode ;
222
230
codeToReason : StreamCodeToReason ;
231
+ maxReadableStreamBytes : number | undefined ;
223
232
logger : Logger ;
224
233
} ) {
225
234
super ( ) ;
@@ -233,6 +242,7 @@ class QUICConnection extends EventTarget {
233
242
this . _remotePort = remoteInfo . port ;
234
243
this . reasonToCode = reasonToCode ;
235
244
this . codeToReason = codeToReason ;
245
+ this . maxReadableStreamBytes = maxReadableStreamBytes ;
236
246
// Sets the timeout on the first
237
247
this . checkTimeout ( ) ;
238
248
@@ -434,11 +444,8 @@ class QUICConnection extends EventTarget {
434
444
destroyingMap : this . destroyingMap ,
435
445
codeToReason : this . codeToReason ,
436
446
reasonToCode : this . reasonToCode ,
437
- logger : this . logger . getChild (
438
- `${ QUICStream . name } ${ streamId } -${ Math . floor (
439
- Math . random ( ) * 100 ,
440
- ) } `,
441
- ) ,
447
+ maxReadableStreamBytes : this . maxReadableStreamBytes ,
448
+ logger : this . logger . getChild ( `${ QUICStream . name } ${ streamId } ` ) ,
442
449
} ) ;
443
450
this . dispatchEvent (
444
451
new events . QUICConnectionStreamEvent ( { detail : quicStream } ) ,
@@ -456,11 +463,8 @@ class QUICConnection extends EventTarget {
456
463
codeToReason : this . codeToReason ,
457
464
reasonToCode : this . reasonToCode ,
458
465
destroyingMap : this . destroyingMap ,
459
- logger : this . logger . getChild (
460
- `${ QUICStream . name } ${ streamId } -${ Math . floor (
461
- Math . random ( ) * 100 ,
462
- ) } `,
463
- ) ,
466
+ maxReadableStreamBytes : this . maxReadableStreamBytes ,
467
+ logger : this . logger . getChild ( `${ QUICStream . name } ${ streamId } ` ) ,
464
468
} ) ;
465
469
this . dispatchEvent (
466
470
new events . QUICConnectionStreamEvent ( { detail : quicStream } ) ,
@@ -659,9 +663,8 @@ class QUICConnection extends EventTarget {
659
663
codeToReason : this . codeToReason ,
660
664
reasonToCode : this . reasonToCode ,
661
665
destroyingMap : this . destroyingMap ,
662
- logger : this . logger . getChild (
663
- `${ QUICStream . name } ${ streamId ! } -${ Math . floor ( Math . random ( ) * 100 ) } ` ,
664
- ) ,
666
+ maxReadableStreamBytes : this . maxReadableStreamBytes ,
667
+ logger : this . logger . getChild ( `${ QUICStream . name } ${ streamId ! } ` ) ,
665
668
} ) ;
666
669
// Ok the stream is opened and working
667
670
if ( this . type === 'client' && streamType === 'bidi' ) {
0 commit comments