File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -280,13 +280,15 @@ class QUICServer extends EventTarget {
280
280
}
281
281
282
282
/**
283
- * This updates the `tlsConfig ` used when new connections are established.
284
- * It will not affect existing connections, they will keep using the old `tlsconfig`
285
- * @param tlsConfig
283
+ * This updates the `QUICConfig ` used when new connections are established.
284
+ * Only the parameters that are provided are updated.
285
+ * It will not affect existing connections, they will keep using the old `QUICConfig`
286
286
*/
287
- public setTLSConfig ( tlsConfig : TlsConfig ) : void {
288
- // tlsConfig is an object, spread to copy and avoid object mutation
289
- this . config . tlsConfig = { ...tlsConfig } ;
287
+ public updateConfig ( config : Partial < QUICConfig > ) : void {
288
+ this . config = {
289
+ ...this . config ,
290
+ ...config ,
291
+ } ;
290
292
} ;
291
293
292
294
/**
Original file line number Diff line number Diff line change @@ -254,7 +254,9 @@ describe(QUICClient.name, () => {
254
254
logger : logger . getChild ( QUICClient . name ) ,
255
255
} ) ;
256
256
const peerCertChainInitial = client1 . connection . conn . peerCertChain ( )
257
- server . setTLSConfig ( certFixtures . tlsConfigFileRSA2 )
257
+ server . updateConfig ( {
258
+ tlsConfig : certFixtures . tlsConfigFileRSA2
259
+ } )
258
260
// The existing connection's certs should be unchanged
259
261
const peerCertChainNew = client1 . connection . conn . peerCertChain ( )
260
262
expect ( peerCertChainNew ! [ 0 ] . toString ( ) ) . toStrictEqual ( peerCertChainInitial ! [ 0 ] . toString ( ) ) ;
@@ -281,7 +283,9 @@ describe(QUICClient.name, () => {
281
283
logger : logger . getChild ( QUICClient . name ) ,
282
284
} ) ;
283
285
const peerCertChainInitial = client1 . connection . conn . peerCertChain ( )
284
- server . setTLSConfig ( certFixtures . tlsConfigFileRSA2 )
286
+ server . updateConfig ( {
287
+ tlsConfig : certFixtures . tlsConfigFileRSA2
288
+ } )
285
289
// Starting a new connection has a different peerCertChain
286
290
const client2 = await QUICClient . createQUICClient ( {
287
291
host : '::ffff:127.0.0.1' as Host ,
You can’t perform that action at this time.
0 commit comments