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()); config.key_log = Arc::new(tokio_rustls::rustls::KeyLogFile::new());
let config = Arc::new(config); let config = Arc::new(config);
for _i in 0..repeat {
let mut handles = Vec::new(); let mut handles = Vec::new();
for _i in 0..repeat {
for (conn_id, (server_name, records)) in records.iter() { for (conn_id, (server_name, records)) in records.iter() {
let connector = TlsConnector::from(config.clone()); let connector = TlsConnector::from(config.clone());
handles.push(tokio::spawn(async move { handles.push(tokio::spawn(async move {
@ -279,14 +279,13 @@ pub async fn play(
})); }));
//tokio::time::sleep(std::time::Duration::from_millis(500)).await; //tokio::time::sleep(std::time::Duration::from_millis(500)).await;
} }
}
for handle in handles { for handle in handles {
handle.await.unwrap(); handle.await.unwrap();
} }
}
} else { } else {
for _i in 0..repeat {
let mut handles = Vec::new(); let mut handles = Vec::new();
for _i in 0..repeat {
for (conn_id, (_server_name, records)) in records.iter() { for (conn_id, (_server_name, records)) in records.iter() {
handles.push(tokio::spawn(async move { handles.push(tokio::spawn(async move {
let mut running_guard = running.lock().await; let mut running_guard = running.lock().await;
@ -364,12 +363,11 @@ pub async fn play(
})); }));
//tokio::time::sleep(std::time::Duration::from_millis(500)).await; //tokio::time::sleep(std::time::Duration::from_millis(500)).await;
} }
}
for handle in handles { for handle in handles {
handle.await.unwrap(); handle.await.unwrap();
} }
} }
}
println!("Unfinished: {:?}", running.lock().await); println!("Unfinished: {:?}", running.lock().await);
if let Some(notify_socket) = notify_socket { if let Some(notify_socket) = notify_socket {

View file

@ -13,7 +13,7 @@ impl<S: AsyncRead + Unpin> StreamCodec<S> {
let mut buf = vec![0; 8]; let mut buf = vec![0; 8];
self.stream.read_exact(&mut buf).await?; self.stream.read_exact(&mut buf).await?;
let expected_len = u32::from_be_bytes(buf[0..4].try_into().unwrap()) as usize; 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()); return Err(std::io::ErrorKind::InvalidData.into());
} }
buf.resize(expected_len, 0); buf.resize(expected_len, 0);