Updates and bug fixes #2

Merged
jjkiers merged 6 commits from new-rust-zig into main 2023-08-25 21:07:24 +00:00
Showing only changes of commit 6349fc6502 - Show all commits

View File

@ -72,21 +72,17 @@ async fn accept(inbound: TcpStream, proxy: Arc<Proxy>) -> Result<(), Box<dyn std
"No upstream named {:?} on server {:?}", "No upstream named {:?} on server {:?}",
proxy.default_action, proxy.name proxy.default_action, proxy.name
); );
return process( return process(inbound, proxy.upstream.get(&proxy.default_action).unwrap()).await;
inbound,
proxy.upstream.get(&proxy.default_action).unwrap().clone(),
)
.await;
// ToDo: Remove unwrap and check default option // ToDo: Remove unwrap and check default option
} }
}; };
return process(inbound, upstream.clone()).await; return process(inbound, &upstream).await;
} }
async fn process( async fn process(
mut inbound: TcpStream, mut inbound: TcpStream,
upstream: Upstream, upstream: &Upstream,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
match upstream { match upstream {
Upstream::Ban => { Upstream::Ban => {