aquatic_ws: almost finish implementing access list support

This commit is contained in:
Joakim Frostegård 2021-10-16 01:08:59 +02:00
parent db596b5038
commit 28cc6c261a
5 changed files with 88 additions and 36 deletions

View file

@ -99,6 +99,19 @@ pub fn handle_announce_requests(
let valid_until = ValidUntil::new(config.cleaning.max_peer_age);
for (request_sender_meta, request) in requests {
let info_hash_allowed = torrent_maps
.access_list
.allows(config.access_list.mode, &request.info_hash.0);
if !info_hash_allowed {
// let response = OutMessage::ErrorResponse();
// out_message_sender.send(request_sender_meta, response);
// wake_socket_workers[request_sender_meta.worker_index] = true;
continue;
}
let torrent_data: &mut TorrentData = if request_sender_meta.converted_peer_ip.is_ipv4() {
torrent_maps.ipv4.entry(request.info_hash).or_default()
} else {