* fix: allow connection between seeds when pex is enabled
* chore: add comment to explain `tr_peerMsgs::on_torrent_got_metainfo()`
* refactor: remove `tr_swarm::mark_peer_as_seed()`
* fix: update seed flag in response to BT msgs
Regression from 81a42c6bb6
* chore: remove redundant code to update peer seed flag
* refactor: inc failure count if there were no piece data exchanged
* fix: save information from ltep handshake
* refactor: rename `tr_peerIo::is_seed_` to disambiguate
* fix: add instead of set pex flags when adding non-pex and non-resume peers
* fix: don't mark peer as connectable on getting ltep port msg
By BEP-11's definition, this flag is only set for peers whom we successfully initiated an outgoing connection with.
* refactor: set holepunch flag when we get it from ltep handshake
* fix: only accept positive `reqq` in ltep handshake
* refactor: handle encryption preference in `tr_peer_info`
* refactor: prefer own value for utp support
* refactor: make `tr_peer_info::from_first_` const
* refactor: handle holepunch support in `tr_peer_info`
* fix: parse metadata size only if we have a valid extention id for metadata xfer
* refactor: remove `tr_peer_info::add_pex_flags()` as it's no longer needed
* fix: correctly handle holepunch support when there is no `m` key in ltep handshake
* fix: distinguish between upload only and seed
Say we just connected to a partial seed, the peer sends an ltep handshake that has the `upload_only` key, then a BT `Bitfield` message:
Without this change, the pex seed flag would be set when parsing the ltep handshake, then immediately unset when parsing the `Bitfield` message.
We don't want that.
* fix: don't update `tr_peer_info::is_seed_` when merging peer info objects
* perf: priority in peer candidate score need 2 bits only
* fix: prefer to connect to downloading peers
Regression from c867f00153
* chore: add TODO for C++20 opportunity
* refactor: don't filter out peers without `ADDED_F_CONNECTABLE`
revert change from a2849219f7
* refactor: move peer state updates out of peermgr code
---------
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* chore: housekeeping
* refactor: reduce copying when building payloads
* feat: dual-stack udp tracker support
* refactor: convert function names to snake_case
* fix: `readability-identifier-naming` warning
* fix: account for dual-stack in tests
* code review: add prefix to global names
* fix: don't resolve to IPv4-mapped address
* refactor: use `tr_address` method to check ip protocol
* fix: workaround MSVC x86 build failure
* fix: handle host components that has square brackets
* Partial Revert: "fix: account for dual-stack in tests"
Not needed anymore
* fix: store ipv6 peers in pex6
---------
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: include <memory> when using shared_ptr or unique_ptr
* refactor: include <cstdio> iff we use it
* refactor: include <cstring> iff we use it
* refactor: include <cstdlib> iff we use it
* refactor: include <string_view> or <string> iff we use it
* refactor: include <array> iff we use it
* refactor: include <ctime> iff we use it
* refactor: include <cctype> iff we use it
* refactor: misc #include cleanups in libtransmission
* perf: use scrape to know when a swarm is all-seeds
For private torrents, the tracker is the sole source of peers. So when a
private torrent's tracker responds that there are 0 leechers, we can use
that information to mark the entire swarm as seeders and to not initiate
connections to those peers if we are seeding. This can help seedboxes to
more efficiently pick which swarms to prioritize.
This strategy is not used on public torrents, since new seeder-to-seeder
connections can be useful there for pex.
This PR changes tr_peerMgrAddPex() to (1) remove tr_atom.seedProbability
field (which was not as robust as intended) and (2) add batches of peers
instead of a single peer.
* fix: only use all-seeds check for private torrents
This way all the qualifiers (`const`, `volatile`, `mutable`) are grouped
together, e.g. `T const* const x` vs. `const T* const x`. Also helps reading
types right-to-left, e.g. "constant pointer to constant T" vs. "constant
pointer to T which is constant".
There're places where manual intervention is still required as uncrustify
is not ideal (unfortunately), but at least one may rely on it to do the
right thing most of the time (e.g. when sending in a patch).
The style itself is quite different from what we had before but making it
uniform across all the codebase is the key. I also hope that it'll make the
code more readable (YMMV) and less sensitive to further changes.
1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed
2. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)
3. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.