diff --git a/ipa-core/Cargo.toml b/ipa-core/Cargo.toml index 7d2216df6..3bc1fd120 100644 --- a/ipa-core/Cargo.toml +++ b/ipa-core/Cargo.toml @@ -142,7 +142,7 @@ thiserror = "1.0" tikv-jemallocator = { version = "0.6", optional = true, features = ["profiling"] } tikv-jemalloc-ctl = { version = "0.6", optional = true, features = ["stats"] } time = { version = "0.3", optional = true } -tiny_http = { version = "0.12", optional = true } +tiny_http = { path = "../../tiny-http", optional = true } tokio = { version = "1.42", features = ["fs", "rt", "rt-multi-thread", "macros"] } tokio-rustls = { version = "0.26", optional = true } tokio-stream = "0.1.14" diff --git a/ipa-core/src/bin/test_mpc.rs b/ipa-core/src/bin/test_mpc.rs index 3735c4c18..fa88102b1 100644 --- a/ipa-core/src/bin/test_mpc.rs +++ b/ipa-core/src/bin/test_mpc.rs @@ -6,7 +6,7 @@ use std::{ net::TcpListener, ops::Add, os::fd::{FromRawFd, RawFd}, - path::PathBuf, + path::PathBuf, thread, }; use clap::{Parser, Subcommand}; @@ -262,23 +262,27 @@ fn serve_input(args: ServeInputArgs) { tracing::info!(target: "request_url", "{}", request.url()); let url = request.url()[1..].to_owned(); - let response = if url.contains('/') { - error!(target: "error", "Request URL contains a slash"); - not_found() - } else { - match File::open(args.directory.join(&url)) { - Ok(file) => Response::from_file(file).boxed(), - Err(err) => { - if err.kind() != ErrorKind::NotFound { - error!(target: "error", "{err}"); + let directory = args.directory.clone(); + + thread::spawn(move || { + let response = if url.contains('/') { + error!(target: "error", "Request URL contains a slash"); + not_found() + } else { + match File::open(directory.join(&url)) { + Ok(file) => Response::from_file(file).boxed(), + Err(err) => { + if err.kind() != ErrorKind::NotFound { + error!(target: "error", "{err}"); + } + not_found() } - not_found() } - } - }; + }; - let _ = request.respond(response).map_err(|err| { - error!(target: "error", "{err}"); + let _ = request.respond(response).map_err(|err| { + error!(target: "error", "{err}"); + }); }); } } diff --git a/ipa-core/tests/hybrid.rs b/ipa-core/tests/hybrid.rs index 50251f8bc..f8f4fbdaa 100644 --- a/ipa-core/tests/hybrid.rs +++ b/ipa-core/tests/hybrid.rs @@ -34,8 +34,8 @@ pub const IN_THE_CLEAR_BIN: &str = env!("CARGO_BIN_EXE_in_the_clear"); #[test] fn test_hybrid() { - const INPUT_SIZE: usize = 100; - const SHARDS: usize = 5; + const INPUT_SIZE: usize = 50_000; + const SHARDS: usize = 2; const MAX_CONVERSION_VALUE: usize = 5; let config = HybridQueryParams { @@ -149,8 +149,8 @@ fn test_hybrid() { #[test] fn test_hybrid_poll() { - const INPUT_SIZE: usize = 100; - const SHARDS: usize = 5; + const INPUT_SIZE: usize = 50_000; + const SHARDS: usize = 2; const MAX_CONVERSION_VALUE: usize = 5; let config = HybridQueryParams {