Increase max codec size, do not split tasks by repeat iteration

This commit is contained in:
Pascal Engélibert 2026-03-20 16:18:16 +01:00
commit 26ee39ac8c
2 changed files with 9 additions and 11 deletions

View file

@ -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);

View file

@ -13,7 +13,7 @@ impl<S: AsyncRead + Unpin> StreamCodec<S> {
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);