* fix: readability-math-missing-parentheses clang-tidy warnings
* chore: remove unused function tr_ctorGetSession()
* chore: remove unused function tr_ctorGetIncompleteDir()
* chore: make generatePublicKey() a lambda
* fix: readability-container-contains warnings
* fix: misc-use-internal-linkage warnings
* chore: inline generate_public_key() since it was only used once
* 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: do not use tr_strlcpy() in tr_strratio()
* refactor: do not use tr_strlcpy() in bindUnixSocket()
* refactor: do not use tr_strlcpy() in trackerView()
* chore: remove tr_strlcpy() unit tests
* chore: remove tr_strlcpy()
* chore: remove -DHAVE_STRLCPY from Xcode build
* fixup! refactor: do not use tr_strlcpy() in trackerView()
chore: fix copypaste bug
* refactor: add tr_compare_3way()
This is a small templated utility function to make libtransmission's
sorting / comparison code more consistent and easier to read.
* chore: rename tr_strvContains to tr_strv_contains
* chore: rename tr_strvStartsWith to tr_strv_starts_with
* chore: rename tr_strvEndsWith to tr_strv_ends_with
* chore: rename tr_strvSep to tr_strv_sep
* chore: rename tr_strvStrip to tr_strv_strip
* chore: rename tr_strvToBuf to tr_strv_to_buf
* refactor: rename tr_saveFile() to tr_file_save()
rename tr_loadFile() to tr_file_read()
rename tr_moveFile() to tr_file_move()
* refactor: rename tr_parseNum() to tr_num_parse()
refactor: rename tr_parseNumRange() to tr_num_parse_range()
* chore: group related functions together in header
* Automatically (re)order include directives (GTK client)
Include our headers first to ease IWYU enforcement.
* Fix includes missing from headers (GTK client)
* Fix build on Mac after includes reordering
* refactor: add tr_rand_obj()
There are a lot of places in the codebase where we need to populate
an integral type or a fixed-size array with random data. To do this,
we instantiate a local on the stack, fill it with tr_rand_buffer(),
and then use it.
This PR creates a helper function to make this a one-liner.