diff --git a/TODO.md b/TODO.md index 0ebc8e5..10fc822 100644 --- a/TODO.md +++ b/TODO.md @@ -17,7 +17,6 @@ * cargo-deny * aquatic_udp - * don't constantly recreate access list cache * request worker: use `ValidUntil::new_with_now` * look at proper cpu pinning (check that one thread gets bound per core) * then consider so_attach_reuseport_cbpf diff --git a/aquatic_udp/src/lib/workers/socket.rs b/aquatic_udp/src/lib/workers/socket.rs index 53b214c..6906d65 100644 --- a/aquatic_udp/src/lib/workers/socket.rs +++ b/aquatic_udp/src/lib/workers/socket.rs @@ -135,6 +135,7 @@ pub fn run_socket_worker( let mut events = Events::with_capacity(config.network.poll_event_capacity); let mut connections = ConnectionMap::default(); let mut pending_scrape_responses = PendingScrapeResponseMap::default(); + let mut access_list_cache = create_access_list_cache(&state.access_list); let mut local_responses: Vec<(Response, SocketAddr)> = Vec::new(); @@ -166,6 +167,7 @@ pub fn run_socket_worker( &state, &mut connections, &mut pending_scrape_responses, + &mut access_list_cache, &mut rng, &mut socket, &mut buffer, @@ -218,6 +220,7 @@ fn read_requests( state: &State, connections: &mut ConnectionMap, pending_scrape_responses: &mut PendingScrapeResponseMap, + access_list_cache: &mut AccessListCache, rng: &mut StdRng, socket: &mut UdpSocket, buffer: &mut [u8], @@ -231,8 +234,6 @@ fn read_requests( let mut bytes_received_ipv4: usize = 0; let mut bytes_received_ipv6 = 0; - let mut access_list_cache = create_access_list_cache(&state.access_list); - loop { match socket.recv_from(&mut buffer[..]) { Ok((amt, src)) => { @@ -272,7 +273,7 @@ fn read_requests( config, connections, pending_scrape_responses, - &mut access_list_cache, + access_list_cache, rng, request_sender, local_responses,