Skip to content

Commit 990de65

Browse files
committed
refactor: move UDP processor csontructor after IP ban check
We don't need the processor if the IP is banned becuase the request will not be processed at all.
1 parent 77cf089 commit 990de65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/servers/udp/server/launcher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ impl Launcher {
146146
});
147147

148148
loop {
149-
let processor = Processor::new(receiver.socket.clone(), tracker.clone(), cookie_lifetime);
150-
151149
if let Some(req) = {
152150
tracing::trace!(target: UDP_TRACKER_LOG_TARGET, local_addr, "Udp::run_udp_server (wait for request)");
153151
receiver.next().await
@@ -171,6 +169,8 @@ impl Launcher {
171169
continue;
172170
}
173171

172+
let processor = Processor::new(receiver.socket.clone(), tracker.clone(), cookie_lifetime);
173+
174174
// We spawn the new task even if there active requests buffer is
175175
// full. This could seem counterintuitive because we are accepting
176176
// more request and consuming more memory even if the server is

0 commit comments

Comments
 (0)