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
2
TODO.md
2
TODO.md
|
|
@ -31,6 +31,8 @@
|
|||
out and everything will start working
|
||||
* stack-allocated vectors for announce request offers and scrape request info
|
||||
hashes?
|
||||
* write new version of extract_response_peers which checks for equality with
|
||||
peer sending request?
|
||||
|
||||
## aquatic_udp
|
||||
|
||||
|
|
|
|||
|
|
@ -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