Commit Graph

6113 Commits

Author SHA1 Message Date
Cœur 6c1cee5f79
fix: crash in printTorrentList() (#6819)
* Fix crash in printTorrentList

* code review: accept nullptr setme
2024-05-05 15:26:41 -05:00
Dzmitry Neviadomski 0e25584e78
Make std::hash specialization for tr_socket_address a struct (#6788)
To be in line with std::hash declaration

See https://en.cppreference.com/w/cpp/utility/hash

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
2024-04-20 21:01:47 -05:00
Dzmitry Neviadomski bd0b74fccb
Use std::declval instead of nullptr cast trick (#6785)
Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
2024-04-15 15:18:43 -05:00
Yat Ho 92519281b0
refactor: convert `tr_webseed` to C++ interface (#6708)
* chore: housekeeping

* refactor: convert `on_idle()` to class method

* refactor: convert `task_request_next_chunk()` to class method

* refactor: convert `onPartialDataFetched()` to class method

* refactor: convert `onBufferGotData()` to class method

* refactor: convert `useFetchedBlocks()` to class method

* refactor: hide some `tr_webseed_task` fields and methods

* refactor: convert `tr_webseed_task` methods to snake_case

* refactor: remove `write_block_data`

* refactor: store reference to `tr_torrent` directly

* refactor: convert `ConnectionLimiter` methods to snake_case

* refactor: convert `tr_webseed` methods to snake_case

* refactor: hide `tr_webseed` callback member variables

* refactor: convert `tr_webseed` to C++ interface
2024-04-02 09:31:20 -05:00
Yat Ho 87862e506d
feat: support different internal and external port for UPnP (#6672)
* feat: support different internal and external port in upnp

* chore: housekeeping

* code review: better log wording
2024-03-31 18:49:19 -05:00
Yat Ho e619718a1e
fix: save sequential download across sessions (#6746) 2024-03-31 15:01:05 -05:00
Yat Ho e1c9fbde60
fix: restore loose data type parsing in RPC and `settings.json` (#6723)
* refactor: incorporate lenient parsing from `tr_variantGet*()` functions into `tr_variant`

* fix: restore loose data types in RPC and settings.json

* fix: workaround GCC defect

* fix: MSVC build
2024-03-31 14:06:36 -05:00
Cœur 460ce7c302
Add start_paused to settings file and daemon (#6728)
* Add daemon-startPaused to settings file

* code review: naming

* "Predefined quarks must be sorted by their string value"

* code review: replacing paused_ with tr_variantDictAddBool/tr_variantDictFindBool

* code review: doc

* Update docs/Editing-Configuration-Files.md

Co-authored-by: Yat Ho <lagoho7@gmail.com>

---------

Co-authored-by: Eugen Beck <beck@cs.rwth-aachen.de>
Co-authored-by: Yat Ho <lagoho7@gmail.com>
2024-03-30 16:39:44 -05:00
Yat Ho 6384abeb2b
fix: invalid socket address in `tr_peerIo::reconnect()` (#6750)
* fix: don't discard socket if reconnect failed

* fix: don't try to reconnect more than once
2024-03-30 15:26:55 -05:00
Charles Kerr d935d364ed
refactor: remove torrent_view virtual class (#6738)
* refactor: remove torrent_view virtual class

* chore: workaround for google-readability-todo warnings

* chore: fix completion tests
2024-03-30 14:45:00 -05:00
Yat Ho 8944e587f9
fix: assert failure when moving torrents to bottom of the queue (#6751) 2024-03-30 13:49:03 -05:00
Cœur bc7d447949
fix shadowed declaration warnings [-Wshadow] (#6759) 2024-03-30 12:56:48 -05:00
Cœur 465b878e8a
Win32 compatibility for get_peer_stats (#6743) 2024-03-28 09:40:08 +00:00
Yat Ho 2ff3ae07d1
fix: more misc `net.cc` fixes (#6735)
* feat: accept ipv6 string in square brackets for `tr_address::from_string()`

* test: add test case for ipv6 string in square brackets

* fix: include square brackets in host component

According to RFC3986:
  host       = IP-literal / IPv4address / reg-name
  IP-literal = "[" ( IPv6address / IPvFuture  ) "]"

* fix: set ipv6-only socket before binding UDP socket

Will return EINVAL on Linux otherwise

* refactor: simplify code using `evutil` when binding TCP socket

* fix: do not set SO_REUSEADDR for listening sockets on Windows systems

Reason: https://stackoverflow.com/a/14388707/11390656

* fix: do not enclose ipv4 address string in square brackets
2024-03-25 21:10:06 -05:00
Yat Ho c223c70644
fix: potential nullptr deference in rpc (#6734) 2024-03-25 09:55:45 -05:00
Yat Ho 3e958cfbaf
feat: µTP delayed ack (#6586)
* chore: rename tr utp functions to snake_case

* refactor: make udp sockets non-blocking

* feat: rudimentary uTP delayed ACK

* chore: housekeeping

* chore: correct comment about µTP packet format
2024-03-24 20:48:23 -05:00
Yat Ho 20aef2f79d
fix: misc net.cc and blocklist.cc fixes (#6717)
* 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`
2024-03-24 17:09:51 -05:00
Cœur 9ddf609d50
KeepEmptyLinesAtTheStartOfBlocks: false (#6726) 2024-03-24 11:25:00 -05:00
Niccolò Maggioni 86498a71e5
feat: add torrent priority to completion script env vars (#6629) 2024-03-17 19:43:08 -05:00
Yat Ho 2548dd478f
feat: periodically refresh dht node id (#6695) 2024-03-17 18:24:36 -05:00
Cœur c63c66c737
fix: Sparkle Version Comparator (#5263)
* fix: Sparkle Version Comparator

* Code review: Reducing CFBundleVersion to three components and avoiding versionComparatorForUpdater

* adding +99 when it's a non-beta release

* code review: set CFBUNDLE_VERSION and unset components

* re-adding support for ignoring beta
2024-03-17 16:23:39 -05:00
Charles Kerr 11b794e656
refactor: allow Settings to register custom serializers / deserializers (#6667) 2024-03-15 23:27:55 -05:00
Yat Ho 152f3e91a5
refactor: convert `tr_peerMsgsImpl` helper functions to class methods (#6580)
* 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>
2024-03-15 19:52:09 -05:00
Cœur 8709ec60e6
run peerMgrPeerStats in session thread (#5992)
* run peerMgrPeerStats in session thread

* code-review: add a TODO: for refactoring
2024-03-15 19:04:43 -05:00
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