mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_ws: don't send peer its own offer
This commit is contained in:
parent
689a874cbe
commit
abc0034a45
2 changed files with 13 additions and 0 deletions
|
|
@ -168,6 +168,17 @@ pub fn handle_announce_requests(
|
|||
);
|
||||
|
||||
for (offer, peer) in offers.into_iter().zip(peers){
|
||||
// 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 sender_meta.peer_addr == peer.connection_meta.peer_addr {
|
||||
continue;
|
||||
}
|
||||
|
||||
let middleman_offer = MiddlemanOfferToPeer {
|
||||
info_hash,
|
||||
peer_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue