udp: split AnnounceResponse into V4 and V6 versions

This commit is contained in:
Joakim Frostegård 2021-11-15 21:32:20 +01:00
parent 4b07e007f3
commit f3e41148fe
9 changed files with 255 additions and 119 deletions

View file

@ -165,7 +165,14 @@ fn process_response(
Some(request)
}
Response::Announce(r) => if_torrent_peer_move_and_create_random_request(
Response::AnnounceIpv4(r) => if_torrent_peer_move_and_create_random_request(
config,
rng,
info_hashes,
torrent_peers,
r.transaction_id,
),
Response::AnnounceIpv6(r) => if_torrent_peer_move_and_create_random_request(
config,
rng,
info_hashes,

View file

@ -129,7 +129,11 @@ fn read_responses(
match Response::from_bytes(&buffer[0..amt]) {
Ok(response) => {
match response {
Response::Announce(ref r) => {
Response::AnnounceIpv4(ref r) => {
ls.responses_announce += 1;
ls.response_peers += r.peers.len();
}
Response::AnnounceIpv6(ref r) => {
ls.responses_announce += 1;
ls.response_peers += r.peers.len();
}