Prevent unnecessary clone
This also ensures that the address resolver actually keeps state. Otherwise it was cloned before each resolution, resulting in it never keeping the resolved addresses. Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
parent
cd35859c9b
commit
6349fc6502
@ -72,21 +72,17 @@ async fn accept(inbound: TcpStream, proxy: Arc<Proxy>) -> Result<(), Box<dyn std
|
||||
"No upstream named {:?} on server {:?}",
|
||||
proxy.default_action, proxy.name
|
||||
);
|
||||
return process(
|
||||
inbound,
|
||||
proxy.upstream.get(&proxy.default_action).unwrap().clone(),
|
||||
)
|
||||
.await;
|
||||
return process(inbound, proxy.upstream.get(&proxy.default_action).unwrap()).await;
|
||||
// ToDo: Remove unwrap and check default option
|
||||
}
|
||||
};
|
||||
|
||||
return process(inbound, upstream.clone()).await;
|
||||
return process(inbound, &upstream).await;
|
||||
}
|
||||
|
||||
async fn process(
|
||||
mut inbound: TcpStream,
|
||||
upstream: Upstream,
|
||||
upstream: &Upstream,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
match upstream {
|
||||
Upstream::Ban => {
|
||||
|
Loading…
Reference in New Issue
Block a user