mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_udp: use cleaner request filtering by access list
This commit is contained in:
parent
8c3db1b9b9
commit
429ffc8301
1 changed files with 10 additions and 15 deletions
|
|
@ -146,22 +146,17 @@ fn read_requests(
|
|||
}
|
||||
|
||||
match request {
|
||||
Ok(request) => {
|
||||
if let Request::Announce(AnnounceRequest { info_hash, transaction_id, ..}) = request {
|
||||
if state.access_list.allows(access_list_mode, &info_hash.0) {
|
||||
requests.push((request, src));
|
||||
} else {
|
||||
let response = Response::Error(ErrorResponse {
|
||||
transaction_id,
|
||||
message: "Info hash not allowed".into()
|
||||
});
|
||||
Ok(Request::Announce(AnnounceRequest { info_hash, transaction_id, ..})) if !state.access_list.allows(access_list_mode, &info_hash.0) => {
|
||||
let response = Response::Error(ErrorResponse {
|
||||
transaction_id,
|
||||
message: "Info hash not allowed".into()
|
||||
});
|
||||
|
||||
local_responses.push((response, src))
|
||||
}
|
||||
} else {
|
||||
requests.push((request, src));
|
||||
}
|
||||
}
|
||||
local_responses.push((response, src))
|
||||
},
|
||||
Ok(request) => {
|
||||
requests.push((request, src));
|
||||
},
|
||||
Err(err) => {
|
||||
::log::debug!("request_from_bytes error: {:?}", err);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue