@@ -580,9 +580,6 @@ mod tests {
580580
581581 let server_config = local_config ( 1 ) ;
582582
583- let max_connections = 3 ;
584- let done_count = Arc :: new ( AtomicUsize :: new ( 0 ) ) ;
585-
586583 // Message to send over TLS
587584 const MSG : & str = "Hello Joe" ;
588585
@@ -592,10 +589,12 @@ mod tests {
592589 pki_keydir. join( "corim-sp.cbor" ) ,
593590 ] ;
594591
595- // Accept connections from 3 clients in different tasks
592+ // Accept connections from `max_connections` clients in different tasks
596593 //
597594 // For this test, the clients all share a set of keys, because
598595 // we only generate 2 sets of keys from the KDL.
596+ let max_connections = 3 ;
597+ let done_count = Arc :: new ( AtomicUsize :: new ( 0 ) ) ;
599598 let dc2 = done_count. clone ( ) ;
600599 tokio:: spawn ( async move {
601600 let server = Server :: new ( server_config, addr, log2. clone ( ) )
@@ -617,11 +616,12 @@ mod tests {
617616 }
618617 } ) ;
619618
620- // Loop until we succesfully connect
619+ // Spawn `max_connections` tasks to concurrently connect
621620 for _ in 0 ..max_connections {
622621 let pki_keydir = pki_keydir. clone ( ) ;
623622 let log = log. clone ( ) ;
624623 tokio:: spawn ( async move {
624+ // Loop until we succesfully connect
625625 let mut stream = loop {
626626 let client_config = local_config ( 2 ) ;
627627
@@ -651,8 +651,8 @@ mod tests {
651651 } ) ;
652652 }
653653
654- // Wait for the other side of the connection to receive and assert the
655- // message
654+ // Wait each spawned server task to receive and assert the message from
655+ // a single client.
656656 while done_count. load ( std:: sync:: atomic:: Ordering :: Relaxed )
657657 != max_connections
658658 {
0 commit comments