diff --git a/src/client.rs b/src/client.rs index ae7c448..7ad9a27 100644 --- a/src/client.rs +++ b/src/client.rs @@ -192,8 +192,8 @@ pub async fn play( } config.key_log = Arc::new(tokio_rustls::rustls::KeyLogFile::new()); let config = Arc::new(config); + let mut handles = Vec::new(); for _i in 0..repeat { - let mut handles = Vec::new(); for (conn_id, (server_name, records)) in records.iter() { let connector = TlsConnector::from(config.clone()); handles.push(tokio::spawn(async move { @@ -279,14 +279,13 @@ pub async fn play( })); //tokio::time::sleep(std::time::Duration::from_millis(500)).await; } - - for handle in handles { - handle.await.unwrap(); - } + } + for handle in handles { + handle.await.unwrap(); } } else { + let mut handles = Vec::new(); for _i in 0..repeat { - let mut handles = Vec::new(); for (conn_id, (_server_name, records)) in records.iter() { handles.push(tokio::spawn(async move { let mut running_guard = running.lock().await; @@ -364,10 +363,9 @@ pub async fn play( })); //tokio::time::sleep(std::time::Duration::from_millis(500)).await; } - - for handle in handles { - handle.await.unwrap(); - } + } + for handle in handles { + handle.await.unwrap(); } } println!("Unfinished: {:?}", running.lock().await); diff --git a/src/codec.rs b/src/codec.rs index e4d37f4..125c274 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -13,7 +13,7 @@ impl StreamCodec { let mut buf = vec![0; 8]; self.stream.read_exact(&mut buf).await?; let expected_len = u32::from_be_bytes(buf[0..4].try_into().unwrap()) as usize; - if expected_len < 8 || expected_len > 8 * 1024 * 1024 { + if expected_len < 8 || expected_len > 16 * 1024 * 1024 { return Err(std::io::ErrorKind::InvalidData.into()); } buf.resize(expected_len, 0);