@@ -345,7 +345,7 @@ where
345
345
if self . is_full ( ) {
346
346
return Err ( ConnectError :: TooManyConnections ) ;
347
347
}
348
- let remote_id = RandomConnectionIdGenerator :: new ( MAX_CID_SIZE ) . generate_cid ( ) ;
348
+ let ( remote_id, _ ) = RandomConnectionIdGenerator :: new ( MAX_CID_SIZE ) . generate_cid ( ) ;
349
349
trace ! ( initial_dcid = %remote_id) ;
350
350
let ( ch, conn) = self . add_connection (
351
351
remote_id,
@@ -363,7 +363,7 @@ where
363
363
fn send_new_identifiers ( & mut self , ch : ConnectionHandle , num : u64 ) -> ConnectionEvent {
364
364
let mut ids = vec ! [ ] ;
365
365
for _ in 0 ..num {
366
- let id = self . new_cid ( ) ;
366
+ let ( id , _ ) = self . new_cid ( ) ;
367
367
self . connection_ids . insert ( id, ch) ;
368
368
let meta = & mut self . connections [ ch] ;
369
369
meta. cids_issued += 1 ;
@@ -378,11 +378,11 @@ where
378
378
ConnectionEvent ( ConnectionEventInner :: NewIdentifiers ( ids) )
379
379
}
380
380
381
- fn new_cid ( & mut self ) -> ConnectionId {
381
+ fn new_cid ( & mut self ) -> ( ConnectionId , Option < Duration > ) {
382
382
loop {
383
- let cid = self . local_cid_generator . generate_cid ( ) ;
383
+ let ( cid, lifetime ) = self . local_cid_generator . generate_cid ( ) ;
384
384
if !self . connection_ids . contains_key ( & cid) {
385
- break cid;
385
+ break ( cid, lifetime ) ;
386
386
}
387
387
assert ! ( self . local_cid_generator. cid_len( ) > 0 ) ;
388
388
}
@@ -396,7 +396,7 @@ where
396
396
opts : ConnectionOpts < S > ,
397
397
now : Instant ,
398
398
) -> Result < ( ConnectionHandle , Connection < S > ) , ConnectError > {
399
- let loc_cid = self . new_cid ( ) ;
399
+ let ( loc_cid, _ ) = self . new_cid ( ) ;
400
400
let ( server_config, tls, transport_config) = match opts {
401
401
ConnectionOpts :: Client {
402
402
config,
@@ -509,7 +509,7 @@ where
509
509
}
510
510
511
511
// Local CID used for stateless packets
512
- let temp_loc_cid = self . new_cid ( ) ;
512
+ let ( temp_loc_cid, _ ) = self . new_cid ( ) ;
513
513
let server_config = self . server_config . as_ref ( ) . unwrap ( ) ;
514
514
515
515
if self . incoming_handshakes == server_config. accept_buffer as usize
0 commit comments