@@ -53,6 +53,7 @@ class QUICServer extends EventTarget {
5353 protected codeToReason : StreamCodeToReason | undefined ;
5454 protected verifyCallback : VerifyCallback | undefined ;
5555 protected connectionMap : QUICConnectionMap ;
56+ protected connectionConnectTime : number ;
5657 // Used to track address string for logging ONLY
5758 protected address : string ;
5859
@@ -109,6 +110,7 @@ class QUICServer extends EventTarget {
109110 reasonToCode,
110111 codeToReason,
111112 verifyCallback,
113+ connectionConnectTime = 2000 ,
112114 logger,
113115 } : {
114116 crypto : {
@@ -124,6 +126,7 @@ class QUICServer extends EventTarget {
124126 reasonToCode ?: StreamReasonToCode ;
125127 codeToReason ?: StreamCodeToReason ;
126128 verifyCallback ?: VerifyCallback ;
129+ connectionConnectTime ?: number ;
127130 logger ?: Logger ;
128131 } ) {
129132 super ( ) ;
@@ -151,6 +154,7 @@ class QUICServer extends EventTarget {
151154 this . reasonToCode = reasonToCode ;
152155 this . codeToReason = codeToReason ;
153156 this . verifyCallback = verifyCallback ;
157+ this . connectionConnectTime = connectionConnectTime ;
154158 }
155159
156160 @ready ( new errors . ErrorQUICServerNotRunning ( ) )
@@ -355,23 +359,28 @@ class QUICServer extends EventTarget {
355359 `Accepting new connection from QUIC packet from ${ remoteInfo . host } :${ remoteInfo . port } ` ,
356360 ) ;
357361 const clientConnRef = Buffer . from ( header . scid ) . toString ( 'hex' ) . slice ( 32 ) ;
358- const connectionProm = QUICConnection . createQUICConnection ( {
359- type : 'server' ,
360- scid : newScid ,
361- dcid : dcidOriginal ,
362- socket : this . socket ,
363- remoteInfo,
364- data,
365- config : this . config ,
366- reasonToCode : this . reasonToCode ,
367- codeToReason : this . codeToReason ,
368- verifyCallback : this . verifyCallback ,
369- logger : this . logger . getChild (
370- `${ QUICConnection . name } ${ scid . toString ( ) . slice ( 32 ) } -${ clientConnRef } ` ,
371- ) ,
372- } ) ;
362+ let connection : QUICConnection ;
373363 try {
374- await connectionProm ;
364+ connection = await QUICConnection . createQUICConnection (
365+ {
366+ type : 'server' ,
367+ scid : newScid ,
368+ dcid : dcidOriginal ,
369+ socket : this . socket ,
370+ remoteInfo,
371+ data,
372+ config : this . config ,
373+ reasonToCode : this . reasonToCode ,
374+ codeToReason : this . codeToReason ,
375+ verifyCallback : this . verifyCallback ,
376+ logger : this . logger . getChild (
377+ `${ QUICConnection . name } ${ scid
378+ . toString ( )
379+ . slice ( 32 ) } -${ clientConnRef } `,
380+ ) ,
381+ } ,
382+ { timer : this . connectionConnectTime } ,
383+ ) ;
375384 } catch ( e ) {
376385 // Ignoring any errors here as a failure to connect
377386 this . dispatchEvent (
@@ -383,7 +392,6 @@ class QUICServer extends EventTarget {
383392 ) ;
384393 return ;
385394 }
386- const connection = await connectionProm ;
387395 // Handling connection events
388396 connection . addEventListener (
389397 'connectionError' ,
0 commit comments