Change single connection mode to CLI arg instead of forced in debug mode

This commit is contained in:
NGnius (Graham) committed 2025-03-16 09:37:16 -04:00
1 parent ec565e904b
commit 792585a031
18 files changed
+81 -81

No files matched your search

+7 -7
View File
@@ -21,16 +21,16 @@ async fn main() -> std::io::Result<()> {
let listener = net::TcpListener::bind(std::net::SocketAddr::new(ip_addr, args.port)).await?;
#[cfg(not(debug_assertions))]
loop {
let (socket, address) = listener.accept().await?;
tokio::spawn(process_socket(socket, address, op_handler.clone(), redirect_static, room_name_static));
}
#[cfg(debug_assertions)]
{
if args.once {
log::warn!("Handling first connection and then exiting");
let (socket, address) = listener.accept().await?;
process_socket(socket, address, redirect_static, room_name_static).await;
Ok(())
} else {
loop {
let (socket, address) = listener.accept().await?;
tokio::spawn(process_socket(socket, address, redirect_static, room_name_static));
}
}
}