* 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>
* fix: `tr_address` should be invalid by default
* fix: allow loopback address for LPD and incoming connections
* fix: `parseCidrline()` should set address type
* code review: keep `memcmp`
* refactor: update bep links
* chore: use more appropriate data types
* chore: checkpoint
* refactor: split `can_request()` into each of their own different signature
* chore: checkpoint
* refactor: convert tr_peerMsgsImpl functions to methods
* chore: checkpoint
* refactor: store peer info as reference
* refactor: convert all member variables to private
* chore: re-arrange methods
* refactor: optimise tmp vector default size in `send_ut_pex()`
* chore: housekeeping
* chore: housekeeping
* refactor: avoid `dynamic_cast` when sending cancel
* fix: restore `blocks_sent_to_peer` stat
regression e91af26923
* fix: choke first then reject
* refactor: convert `tr_peerMsgsNew()` to static factory function
* refactor: store `tr_torrent` reference instead of pointer
* Revert "refactor: store peer info as reference"
This reverts commit bb419bf2
---------
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: move tr_tracker_http_announce() helper funcs into their own namespace
* refactor: move tr_globalIPv6() helper funcs into their own namespace
* refactor: move tr_address_is_valid_for_peers() helper funcs into their own namespace
* refactor: make tr_address_compare() a private method
* refactor: rename tr_address::isIPv4() to is_ipv4()
* refactor: use snake_case for tr_address methods
* refactor: make tr_address_is_valid_for_peers() a member function
* refactor: make tr_session.private_peer_port a private field
chore: make tr_session.public_peer_port a private field
* refactor: make tr_session.web_ a private field
* refactor: make tr_session.lpd_ a private field
* refactor: make tr_session.bind_ipv4_ private
refactor: make tr_session.bind_ipv6_ private
* refactor: make tr_session.bandwidth_groups_ private; add const accessor
* refactor: make tr_session.port_forwarding_ private
* refactor: make tr_session.peerMgr private pt 1: add tr_session::addIncoming()
* refactor: make tr_session.peerMgr private pt 1: add tr_session::addTorrent()
* refactor: make tr_session.peer_mgr_ private
* refactor: make tr_session.setPeerPort() private
* Sync translations with code
* Sync translations with Transifex
* Remove Mac menu title that isn't displayed and shouldn't be translated
* Add context to logging level strings in GTK client
* Use "µTP" consistently in code
* Use ellipsis instead of three docs in Qt client strings
* Close HTML tags in blocklist-related strings
* Remove trailing space from a translatable string in Qt client
* Add missing plural forms for English strings in Qt client
* Fix spelling: metaInfo -> metainfo
Add a shim between the handshake code and the rest of the codebase to
improve decoupling so that a followup PR can add handshake unit tests.
The handshake code no longer directly relies on tr_torrent, tr_session,
tr_dht, or tr_peerMgr.
* refactor: remove tr_address_compare()
* refactor: remove tr_address_to_string()
* refactor: remove NUM_TR_AF_INET_TYPES
* refactor: replace tr_sessionGetPublicAddress with tr_session::getPublicAddress()
* refactor: tr_peerIo() takes tr_address by value
* refactor: replace tr_sessionIsAddressBlocked with tr_session::isAddressBlocked()
* refactor: tr_peerMgrAddIncoming now takes tr_address by value
* refactor: replace tr_address_is_valid_for_peers() with tr_address.isValidForPeers()
* refactor: tr_netOpenPeerSocket takes tr_address by value
* refactor: remove tr_generateAllowedSet()
* refactor: setup_sockaddr takes a tr_address by value
* refactor: tr_netBindTCP() takes a tr_address by value
* refactor: tr_dhtAddNode() takes a tr_address by value
* refactor: remove tr_address_from_string()
* refactor: rename tr_address.isValidForPeers() to .isValidPeerAddress()
* refactor: replace tr_address_from_sockaddr_storage() with tr_address::fromSockaddrStorage()
* refactor: minor cleanup to tr_address::readable()
* refactor: make tr_peerIoGetAddress() a member function
* refactor: make tr_peerIo.addr a private field
* refactor: make tr_peerIoIsIncoming a member function
* refactor: make tr_peerIoHasBandwidthLeft a member function
* refactor: make tr_peerIoGetPieceSpeed_Bps a member function
* refactor: make tr_peerIoSupportsFEXT() a member function
* refactor: mark tr_peerIo::supportsDHT nodiscard
* refactor: update naming style for tr_peerIo fields
* refactor: make tr_peerIo.is_seed a private field