Commit Graph

6089 Commits

Author SHA1 Message Date
Cœur edc59ba5d8
fix compatibility with clang-format 18 (#6690)
* fix clang-format

* compatibility with clang-format 17-18
2024-03-15 00:17:10 -05:00
Cœur 6909ec0bad
build: fix building on macOS 10.14.6, 10.15.7 and 11.7 (#6590) 2024-03-09 10:27:20 -06:00
Charles Kerr 50dca24f50
refactor: aggregate crypto handles when computing digests (#6662)
* refactor: aggregate per-crypto-pkg fields instead of using inheritance
2024-03-04 16:59:51 -06:00
Charles Kerr efd6790973
refactor: remove tr_sys_file_flush() (#6647) 2024-03-03 23:29:38 -06:00
Charles Kerr 1855cdb731
refactor: replace tr_sys_file_write_line() with fmt::print("...\n") (#6619)
* refactor: use fmt::print in log.cc

https://github.com/fmtlib/fmt/issues/428#issuecomment-395442159
> You can use fmt::print("...\n") on Windows as well.

Use this mechanism instead of tr_sys_file_write_line()

* refactor: use FILE* in daemon

* refactor: remove unused tr_sys_file_flush_possible()

* refactor: remove unused tr_sys_file_write_line()

* refactor: remove unused tr_sys_file_get_std()

* refactor: remove unused tr_std_sys_file_t
2024-02-25 16:12:08 -06:00
Charles Kerr a90d0fce2b
refactor: inline simple getters in qt client (#6621)
* refactor: make RpcClient::url() constexpr

* refactor: make Session::getRemoteUrl() constexpr

* refactor: make RpcQueue::setTolerateErrors() constexpr

* refactor: make RpcClient::isLocal() constexpr

* refactor: make Session::isLocal() constexpr

* refactor: make Session::isServer() constexpr

* refactor: make PathButton::label() constexpr

* chore: remove accidentally-committed makelog file
2024-02-18 18:48:27 -06:00
Charles Kerr b1b685af3f
refactor: make tr_torrentReqIsValid() private (#6620) 2024-02-18 16:00:13 -06:00
Charles Kerr 189fe73575
refactor: remove TR_PATH_DELIMITER (#6618) 2024-02-18 01:47:12 -06:00
Yat Ho 348177863a
fix: don't consider peer info inactive if any of the time values is 0 (#6606) 2024-02-17 23:46:02 -06:00
Charles Kerr d11cddc39a
fix: sonarcloud warnings (#6615)
* fix: cpp:S3358 conditional-operators-should-not-be-nested warning in gtk client

* fix: cpp:S1659 define-each-identifier-in-a-dedicated-statement warning in peer-mgr-wishlist

* Revert "fix; cpp:S3642 replace-enum-with-enum-class warning in gtk client"

* fix: cpp:S3576 remove-virtual-specifier-or-replace-it-by-override warning in rpc-server::Settings

* fix: cpp:S3576 remove-virtual-specifier-or-replace-it-by-override warning in tr_session_alt_speeds::Settings

* fix: remove unnecessary Settings subclass declarations

* fix: cpp:S1117 shadow warning in qt client

* fix: cpp:S6004 use init-statement to limit scope of local

* fix: cpp:S5997 replace-std-lock-guard-with-std-sccoped-lock in favicon-cache.h

* fix: cpp:S1659 define-each-identifier-in-a-dedicated-statement warning in announcer

* fix: cpp:S5817 function-should-be-declared-const warning in cache.h

* fix: cpp:S1186 explain-why-method-is-empty warning in favicon-cache

* fix: cpp:S5408 constexpr-variables-should-not-be-declared-inline warning in favicon-cache

* fix: cpp:S3624 explicitly delete copy assignment, ctor of InFlightData

* fix: cpp:S5997 use std-scoped-lock-instead-of-std-lock-guard

* fix: cpp:S5997 use std-scoped-lock-instead-of-std-lock-guard

* fix: cpp:S5817 function-should-be-declared-const warning in favicon-cache.h

* fix: cpp:S5817 function-should-be-declared-const warning in lru-cache

* fix: cpp:S1709 add-the-explicit-keyword-to-this-constructor
2024-02-17 22:43:24 -06:00
Yat Ho 16f25e1158
fixup! perf: restore `3.00` wishlist with cached candidates (#6549) (#6604) 2024-02-16 08:28:37 -06:00
Charles Kerr c14d445cf5
refactor: libtransmission Settings (#6592)
* refactor: make tr_session_settings a libtransmission::Settings

* refactor: make VariantConverter private in settings.cc
2024-02-15 11:31:09 -06:00
Charles Kerr eeea3c540f
fix: clang-tidy-19 warnings (#6597)
* fix: readability-redundant-casting warnings in libtransmission

* fix: readability-avoid-return-with-void-value warnings in libtransmission

* fix: readability-redundant-member-init warnings in libtransmission

* fix: readability-redundant-inline-specifier warnings in libtransmission

* fix: performance-avoid-endl warnings in libtransmission

* fix: bugprone-multi-level-implicit-pointer-conversion warnings in libtransmission

* fix: bugprone-switch-missing-default-case warnings in libtransmission

* fix: readability-redundant-string-cstr warnings in libtransmission

* fixup! fix: bugprone-multi-level-implicit-pointer-conversion warnings in libtransmission
2024-02-13 10:42:19 -06:00
Mrnikifabio f06cb37c06
feat: added `sleep-per-seconds-during-verify` to settings.json (#6572)
* feat: added `sleep-per-seconds-during-verify` to settings.json

* Ensuring `sleep_per_seconds_during_verify > 0` in `verify_torrent` for better performance

* `#include` list reordered alphabetically

* fix: `[readability-inconsistent-declaration-parameter-name]` warning
2024-02-12 09:30:40 -06:00
Yat Ho cf84afda8c
perf: followup improvements to `3.00` Wishlist (#6589)
* refactor: replace `small:set` with `small::vector`

* perf: faster `Wishlist::resort_piece()`

* refactor: PImpl idiom
2024-02-11 21:13:59 -06:00
Cœur 564d813b41
fix crash on empty filedescriptor after `accept` (#6585) 2024-02-11 20:40:41 -06:00
Cœur ee1e762394
chore: crash report messages are now unsupported (#6583) 2024-02-10 21:15:31 -06:00
Cœur 9bc8ed8e46
fix: right const (#6588) 2024-02-08 23:54:59 -06:00
Charles Kerr 340d0d4966
refactor: add libtransmission::Settings (#6575)
* refactor: add libtransmission::Settings

* refactor: move RPC server's settings into tr_rpc_server::Settings

* build: update project.pbxproj

---------

Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>
2024-02-07 10:14:47 -06:00
Yat Ho 168d56cefc
perf: restore `3.00` wishlist with cached candidates (#6549)
* feat: rewrite Wishlist to cache candidates

* feat: implement mediator and observers

* feat: rewrite existing tests to work for current implementation

* fix: incorrect block spans for existing tests

* feat: add new tests for new features

* fix: clang shadow warning

* fix: heap-use-after-free in tests

* fixup! feat: rewrite Wishlist to cache candidates

* chore: update comment

* code review: reserve vector memory

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-02-05 00:14:34 -06:00
Yat Ho ca11c33d05
fix: various DHT bugs (#6569)
* fix: unconditionally send DHT Port msg if supported

* chore: add "maybe" to dht add_node functions

* feat: change `bind-address-ipv*` defaults to empty string

* chore: housekeeping

* fix: initialise DHT node id with random bytes

* chore: housekeeping
2024-02-04 12:18:01 -06:00
Charles Kerr a51f08e532
perf: prefer small containers (#6542)
* perf: make pref_is_savable() constexpr

* refactor: use std::vector in tr_torrents::removedSince()

* chore: remove unused typedef in OptionsDialog

* perf: use std::vector in tr_num_parse_range()

* perf: use small::max_size_set in FileTreeItem::update()

* perf: use small:set in Wishlist::next()

* perf: use small:map in FilterBar

* perf: use small::map for counts in tr_logAddMessage()

* perf: use small::max_size_map in FileTreeModel::twiddleWanted()

perf: use small::max_size_map in FileTreeModel::twiddlePriority()

* perf: use a std::array instead of std::map in TorrentFilter::update()

* perf: use a std::array instead of std::map in TorrentSorter::set_mode()

* perf: use a std::array instead of std::map in TorrentSorter::update()

* perf: use small::set in Application::Impl::on_rpc_changed_idle()

* perf: use std::array for MessageLogColumnsModel::level_names_

* fixup! perf: use std::array for MessageLogColumnsModel::level_names_

* fixup! perf: use small::map for counts in tr_logAddMessage()
2024-01-27 09:33:12 -06:00
Yat Ho 32ef92e7a7
feat: do separate IPv4 and IPv6 port checks in Qt and GTK Client (#6525)
* fix: specify `port-test` ip protocol in response when possible

* feat: IPv4 and IPv6 port test in Qt Client

* feat: shorten timeout of `port-test`

* feat: IPv4 and IPv6 port test in Gtk Client

* chore: housekeeping

* refactor: remove IP protocol error message

* code review: mikedld gtk

* feat: return tag in qt rpc response

* code review: mikedld qt

* feat: move port test button up alongside spin button

* fixup! code review: mikedld gtk

* fixup! code review: mikedld qt

* code review: port status initial text

* feat: decouple ipv4 and ipv6 status updates (GTK)

* feat: decouple ipv4 and ipv6 status updates (Qt)

* code review: unknown protocols are non-pending

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* code review: simplify status text when the statuses are the same

* Revert "feat: return tag in qt rpc response"

This reverts commit 2a022c2bb0ee7ddad81f8176839cf0d043422368.

* code review: add translation context for status text (GTK)

* code review: move `port_test_pending_` to `Impl` (GTK)

* fixup! code review: move `port_test_pending_` to `Impl` (GTK)

---------

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2024-01-21 16:50:26 -06:00
Yat Ho 08b2fa7e35
fix: restore `files-wanted` argument of `torrent-set` (#6534)
* chore: drop redundant if branch

* chore: housekeeping

* refactor: always keep error message as the second

* fix: restore `files-wanted` argument of `torrent-set`
2024-01-21 14:41:13 -06:00
Geoffrey Bonneville 7030b53e2e
android patches for ndk (#6024)
* android patches for ndk

* Update libtransmission/file-capacity.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* TrMacros: Move common & android vars

* Build android in CI

* Use vcpkg packages for curl & openssl

* Update CI for android

* Fix ndkVersion used with gradle

* Restore actions triggers events

* CMakeLists: Remove cond where curl is not found

* Use vcpkg tag instead of commit hash

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* TrMacros.cmake: clean unused variables & add vcpkg cond

* Remove quotes around VcpkgAndroid inclusion

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* actions: split steps to install vcpkg packages

* Build for android arm64

* actions: add make-android condition

* Revert "Use vcpkg tag instead of commit hash"

This reverts commit 65819026b1.

* build.gradle: use cmake version 3.22.1

* actions: use vcpkg 2024.01.12

* actions: Add ninja-build dependency

---------

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2024-01-21 15:27:24 +00:00
Yat Ho a1160f1556
fix: keep peer io alive inside utp callback (#6507) 2024-01-20 18:09:28 -06:00
Charles Kerr 468de87076
refactor: fix cppcoreguidelines-avoid-do-while warnings (#6527)
* fix: avoid do-while in tr_sys_file_lock()

* fix: avoid do-while in BitfieldTest

* chore: set cppcoreguidelines-avoid-do-while.IgnoreMacros

* fix: avoid do-while in FileList::Impl::onRowActivated()

* fix: avoid do-while in tr_spawn_async_in_parent()

* fix: avoid do-while in handle_sigchld()

* fixup! fix: avoid do-while in tr_spawn_async_in_parent()

* fixup! fix: avoid do-while in FileList::Impl::onRowActivated()

* fixup! fix: avoid do-while in tr_spawn_async_in_parent()

fix fd leak regression

* fixup! fix: avoid do-while in tr_spawn_async_in_parent()
2024-01-20 16:56:42 -06:00
Yat Ho 0ce4adf07c
fix: always schedule uTP ack after receiving a packet (#6508)
* fix: always schedule uTP ack after receiving a packet

* chore: add comment to explain change
2024-01-15 00:28:50 -06:00
Yat Ho 8b8e9f5c6d
fixup! fix: include daemon-specific options in app defaults (#6505)
* fixup! fix: include daemon-specific options in app defaults (#6499)

* fix: windows build failure

* Revert "fixup! fix: include daemon-specific options in app defaults (#6499)"

This reverts commit 92c2106cc607df36aca4ba28e8c20bd96fa87688.

* refactor: define daemon-specific quarks in libtransmission
2024-01-11 13:20:22 +00:00
Yat Ho 33f11f8679
fix: use one variable to store `TR_KEY_rpc_authentication_required` (#6514) 2024-01-09 23:12:53 -06:00
Charles Kerr 239478925f
fix: performance-enum-size warnings (#6504) 2024-01-08 08:32:58 -06:00
Charles Kerr 9d433ff8b4
fix: misc-include-cleaner clang-tidy warnings (#6502) 2024-01-07 14:21:05 -06:00
Charles Kerr 3f6969217c
chore: remove FMT_STRING macros (#6497) 2024-01-06 14:05:18 -06:00
Yat Ho df1dc5812c
fix: restore the `tag` key in RPC response (#6492)
* fix: restore the `tag` key in RPC response

* chore: `tr_rpc_request_exec()` housekeeping

* feat: new tests for RPC tag
2024-01-06 10:40:23 -06:00
Yat Ho 4bb9eab0d0
fix: app defaults should override libtransmission defaults (#6495) 2024-01-06 10:10:14 -06:00
Charles Kerr 646883174b
chore: fix misc-use-anonymous-namespace warnings from clang-tidy (#6488) 2024-01-04 23:12:51 -06:00
Charles Kerr 23eb0ef92d
chore: fix reference to temporary (#6484) 2024-01-04 08:52:08 -06:00
Yat Ho 4cfd9f0c9e
fix: restore `alt-speed-enabled` config parameter (#6483) 2024-01-03 22:58:21 -06:00
Yat Ho dce0d37130
fixup! fix: implement proper download limit for uTP (#6416) (#6481) 2024-01-03 11:27:11 -06:00
Charles Kerr 22cde5d4b9
refactor: use new tr_variant API in rpcimpl (#6456)
* refactor: tr_rpc_request_exec_json takes a std::function callback

* refactor: tr_rpc_request_exec_json callback takes a tr_variant&&

* refactor: use new tr_variant API in rpcimpl.cc

* refactor: tr_rpc_request_exec_json() now takes a const& to the request

* fixup! refactor: use new tr_variant API in rpcimpl.cc

* chore: rename function to tr_rpc_request_exec()

* chore: remove unused DetailsDialog::Impl::build_torrent_ids_variant_list()

* refactor: minor copyediting in rpcimpl.cc getTorrents()

* refactor: split handler methods between sync, async

* refactor: remove unused args_out param from AsyncHandlers

* chore: fix new readability-inconsistent-declaration-parameter-name warning
2024-01-02 22:14:43 -06:00
Yat Ho 10d047005a
refactor: convert `tr_incomplete_metadata` to c++ class (#6383)
* refactor: unset peer BEP-9 support if size hint is invalid

* fix: open torrent file in binary mode

* refactor: move metadata size check to method

* refactor: remove duplicate checks

* refactor: reduce temp variable scope in `parseLtepHandshake()`

* refactor: convert `get_piece_length()` to method

* refactor: convert `tr_torrentSetMetadataSizeHint()` to method

* refactor: convert `tr_torrentGetMetadataPiece()` to method

* refactor: convert `tr_torrentUseMetainfoFromFile()` to method

* refactor: convert `tr_torrentSetMetadataPiece()` to method

* refactor: convert `tr_torrentGetNextMetadataRequest()` to method

* refactor: convert `tr_torrentGetMetadataPercent()` to method

* refactor: add basic framework for MagnetMediator

* refactor: initialise `tr_incomplete_metadata` fields in constructor

* refactor: check metadata transfer completion in `set_metadata_piece()`

* refactor: convert `use_new_metainfo()` and `on_have_all_metainfo()` to methods

* refactor: move parts of `tr_torrent::set_metadata_piece()` into `tr_incomplete_metadata`

* refactor: move parts of `tr_torrent::get_next_metadata_request()` into `tr_incomplete_metadata`

* refactor: move parts of `tr_torrent::get_metadata_percent()` into `tr_incomplete_metadata`

* refactor: hide all `tr_incomplete_metadata` fields

* refactor: move `incomplete_metadata` to private

* feat: add test for `set_metadata_piece()`

* refactor: unify integer types

* refactor: rename `tr_incomplete_metadata` to `tr_metadata_download`

* chore: make clang-tidy happy

libtransmission/torrent-magnet.cc:117:68: warning: comparison of integers of different signs: 'long' and 'const uint64_t' (aka 'const unsigned long') [clang-diagnostic-sign-compare]

* refactor: pass log name to `tr_metadata_download` constructor

* chore: iwyu

* fix: thread-safe `TorrentMagnetTest.setMetadataPiece`

* chore: housekeeping

* Revert "fix: thread-safe `TorrentMagnetTest.setMetadataPiece`"

This reverts commit 2a7fcd93a262888f9f55d542b1a9a2da9ca72cea.

* fix: stop soon instead of stop now in `on_metainfo_completed()`

This is unreachable code now, but if it is ever reached, Transmission
will very likely crash.

* fix: maybe fix OpenBSD test failure
2024-01-02 21:04:17 -06:00
Yat Ho 5000edef01
fix: implement proper download limit for uTP (#6416)
* fix: return read buffer size in libutp read buffer size callback

* refactor: clamp amount of data processed in `can_read_wrapper()`

* chore: housekeeping

* refactor: call `utp_read_drained()` in on-read callback

so that uTP acks can be sent out in a more timely fashion
2024-01-02 00:33:53 -06:00
Cœur 376d806b2e
build: fix libtransmission build on very old cmake versions (#6418)
* Fix libtransmission build requirements

* code review: keeping compatibility with deprecated cmake
2024-01-01 21:58:22 -06:00
Cœur e5e768e2ab
fix: implicit conversion loses integer precision (#6466) 2023-12-31 14:04:26 -06:00
Mike Gelfand 9c4d28dd08
fix: a couple of logging format issues (#6463)
* Fix swapped log args in `do_log_system_error()`

* Fix invalid fmt use in `tr_rpc_server::load()` logging
2023-12-30 08:56:34 -06:00
qu1ck 427d813108
fix: support sequentialDownload in list of RPC torrent-get response keys (#6450) 2023-12-29 09:05:37 -06:00
Charles Kerr 501487b8cf
refactor: remove tr_parse_result enum (#6435) 2023-12-24 18:05:18 -06:00
Charles Kerr 69577ea4b9
fix: invalid TR_TORRENT_TRACKERS env var for some torrents (#6434) 2023-12-24 14:21:56 -06:00
Charles Kerr 5e51fda92e
refactor: remove tr_strlcpy() (#6433)
* 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
2023-12-24 13:33:33 -06:00
Charles Kerr 0ef34878de
refactor: remove tr_str_is_empty() (#6432)
* refactor: do not u se tr_str_is_empty() in tr_torrentSetLocation()

* refactor: do not use tr_str_is_empty() in remote.cc

* refactor: do not use tr_str_is_empty() in subprocess-win32

* refactor: remove tr_str_is_empty()
2023-12-24 12:01:49 -06:00