diff options
Diffstat (limited to 'src/http/mod.rs')
| -rw-r--r-- | src/http/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/http/mod.rs b/src/http/mod.rs index 8a00745..c95cd16 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -102,7 +102,6 @@ impl Res { /// feature-conditional visibility. mod server { pub struct Server { - pub handle: std::thread::JoinHandle<()>, pub addr: String, } } @@ -124,7 +123,9 @@ pub fn spawn(cfg: Config, db: Db) -> std::io::Result<Server> { let addr = server.server_addr().to_ip().map(|a| a.to_string()).unwrap_or_else(|| cfg.bind.clone()); let state = Arc::new(State { cfg, db }); eprintln!("aur-build listening on http://{addr}"); - let handle = std::thread::Builder::new() + // Detached on purpose: the accept loop owns the listener and runs until the + // process ends, and nothing joins it, so the handle would be stored unread. + std::thread::Builder::new() .name("http-accept".into()) .spawn(crate::time::inherit(move || { for request in server.incoming_requests() { @@ -139,7 +140,7 @@ pub fn spawn(cfg: Config, db: Db) -> std::io::Result<Server> { .ok(); } }))?; - Ok(Server { handle, addr }) + Ok(Server { addr }) } fn serve(state: Arc<State>, mut request: tiny_http::Request) -> std::io::Result<()> { |
