aquatic_common: extract response peers: don't return sender

Seems to fix or at least help with some issues with
real clients being slow to initiate transfers
This commit is contained in:
Joakim Frostegård 2020-08-16 23:07:39 +02:00
parent b5452c2954
commit 6ee8ed4895
6 changed files with 89 additions and 70 deletions

View file

@ -178,23 +178,13 @@ pub fn handle_announce_requests(
rng,
&torrent_data.peers,
max_num_peers_to_take,
request.peer_id,
f
);
for (offer, offer_receiver) in offers.into_iter()
.zip(offer_receivers)
{
// Avoid sending offer back to requesting peer. This could be
// done in extract_announce_peers, but it would likely hurt
// performance to check all peers there for their socket addr,
// especially if there are thousands of peers. It might be
// possible to write a new version of that function which isn't
// shared with aquatic_udp and goes about it differently
// though.
if request_sender_meta.naive_peer_addr == offer_receiver.connection_meta.naive_peer_addr {
continue;
}
let middleman_offer = MiddlemanOfferToPeer {
action: AnnounceAction,
info_hash: request.info_hash,