Commit Graph

320 Commits

Author SHA1 Message Date
Charles Kerr c364abcb6f
chore: misc-include-cleaner (partial) (#5738) 2023-07-06 10:00:07 -05:00
Charles Kerr 56b27057fd
refactor: add lightweight observable / observer for decoupling (#5716) 2023-07-04 15:47:18 -05:00
Charles Kerr 6a2a4c3032
perf: move log strings instead of cloning them (#5726) 2023-07-04 14:03:45 -05:00
Charles Kerr e68b76bc14
perf: use small::unordered_map in tr_torrent::primary_mime_type() (#5722) 2023-07-04 09:40:36 -05:00
Charles Kerr 8183d7fddf
refactor: utils naming (#5696)
* 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
2023-06-30 09:49:58 -05:00
tearfur b79de0b431
perf: convert comparator functors to static constexpr (#5687) 2023-06-29 13:13:25 -05:00
Василий Чай ddac05954b
fix: return error when renaming into existing file (#5563) 2023-06-19 00:30:55 -05:00
Daniel Kamil Kozar c1c27f3da0
Expose files' begin and end pieces via RPC (#5578)
* Expose files' begin and end pieces via RPC

This adds two arguments, `beginPiece` and `endPiece`, for each of the entries
in the `files` array of the RPC's `torrent-`get` method.

The point is to allow RPC clients to display a file's completion progress as
piece-based in addition to byte-based.
2023-06-05 13:15:32 -05:00
Charles Kerr c61d8b7cf7
refactor: rename tr_tracker_view.host to .host_and_port for clarity (#5508) 2023-05-08 20:28:10 -05:00
Charles Kerr 0d3b321bac
refactor: use snake_case for libtransmission class methods (#5497) 2023-05-05 23:11:05 -05:00
Charles Kerr 9d2507c7e3
refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -05:00
midzer 68e965aa28
perf: pass by reference (#4876) 2023-04-14 17:06:26 -05:00
Charles Kerr d72cb67cfb
chore: include directory name in libtransmission #includes (#5308) 2023-04-14 14:33:23 -05:00
Charles Kerr 5cc3bf8a97
fix: generate peer-id on launch (#5233) 2023-03-15 20:53:48 -05:00
Charles Kerr 3aeefec203
chore: remove unused header includes (#5227) 2023-03-14 18:36:15 -05:00
Charles Kerr b354337720
ci: check for clang tidy errors in libtransmission (#5188) 2023-03-10 00:23:22 -06:00
Charles Kerr d3273504bd
fix: 5053 old torrent files keep appearing (#5117) 2023-03-01 20:12:19 -06:00
Cœur 63653b4831
fix: recheckCompleteness on setDownloadDir (#5060) 2023-02-28 08:51:11 -06:00
wiz78 450e98fd91
fix: TR_TIME_LOCALTIME value in torrent scripts (#5006) 2023-02-23 07:18:29 -06:00
Charles Kerr adf5051d46
fix: revert tr_torrentStat() acquires a session thread lock (#4571)
This reverts commit e4b480ecd4.
2023-02-17 23:11:24 -06:00
Cœur 9b69c7d5ff
Don't force fetch metainfo at startup and new torrents. (#4895) 2023-02-14 22:19:47 -06:00
Charles Kerr 4461aa68d9
fix: handle block fragments that arrive from peers out-of-order (#4890) 2023-02-14 13:50:28 -06:00
Charles Kerr f551b4adbf
fix: magnet links are always paused when added (#4856) 2023-02-13 12:33:33 -06:00
Julien 4b8cfa2e57
chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
SweetPPro 1e988c9ce4
fix magnet link start logic (#4528) 2023-02-02 00:19:20 -06:00
Charles Kerr e35d65bf4c
fix: call setHasPiece(piece, false) on checkPiece fail (#4665) 2023-01-29 19:46:26 -06:00
Charles Kerr 0f4077a445
fix: announcer not updated after torrent announce list edited (#4635) 2023-01-22 11:53:08 -06:00
Charles Kerr b5c9e3d697
fix: clang-tidy warnings in libtransmission/transmission.h (#4628) 2023-01-21 13:49:43 -06:00
Charles Kerr 33a7d131b4
feat: add setting to choose between lazy-verify or full verify (#4611) 2023-01-18 02:09:29 -06:00
Cœur e4c5981545
feat: log which tracker is giving a warning (#4544) 2023-01-17 01:46:43 -06:00
Dmitry Antipov bd461e1081
refactor: use std::function for announcer callback (#4575) 2023-01-15 12:37:54 -06:00
Dmitry Antipov 0af121004c
chore: remove unused callback arg (#4573) 2023-01-10 14:47:53 -06:00
Charles Kerr e4b480ecd4
fix: tr_torrentStat() acquires a session thread lock (#4571) 2023-01-10 09:05:31 -06:00
Charles Kerr cb10255ef1
refactor: misc-use-anonymous-namespace pt. 4 (#4550) 2023-01-07 12:58:16 -06:00
Charles Kerr 9678b26984
refactor: misc-use-anonymous-namespace pt. 3 (#4539) 2023-01-07 08:27:54 -06:00
Charles Kerr cc4cbff049
refactor: misc-use-anonymous-namespace pt. 2 (#4538) 2023-01-04 22:16:22 -06:00
Cœur 559b759ea0
Fix tr_torrent_view incorrectly returning is_folder false for single files in a single folder (#4454) 2022-12-23 13:52:16 -06:00
Charles Kerr 4549cc74a0
refactor: add tr_torrent::do_idle_work() (#4434) 2022-12-21 17:21:28 -06:00
Charles Kerr 76db72bc4b
perf: lazy-calculate torrent seconds-seeding stat (#4393) 2022-12-18 22:59:58 -06:00
Charles Kerr 0ee93068bb
fix: TR_TORRENT_LABELS env var in scripts (#4260) 2022-11-27 21:59:45 -06:00
Charles Kerr 49393daf01
refactor: use std::optional.value_or() (#4255) 2022-11-27 14:56:34 -06:00
Charles Kerr 40c7f5bceb
perf: constexpr and move work outside of loops (#4224) 2022-11-22 14:00:09 -06:00
Charles Kerr d27c4c59ce
refactor: incremental announcer refactor pt. 2 (#4214) 2022-11-18 23:00:25 -06:00
Charles Kerr 42f26aad0b
fix: ftbfs on Windows (#4204) 2022-11-16 18:03:48 -06:00
Charles Kerr d2125ee965
perf: revert e065565cd to restore async dns lookups (#4182) 2022-11-15 11:16:49 -06:00
Charles Kerr 9e06cf8f2e
refactor: make DHT unblocking (#4122) 2022-11-11 10:09:24 -06:00
Charles Kerr 831eb8d40f
refactor: make `tr_session_thread` a unique_ptr owned by tr_session (#4069) 2022-11-04 16:20:27 -05:00
Charles Kerr e065565cd4
reafctor: use getaddrinfo() instead of evdns (#4094) 2022-11-04 13:29:56 -05:00
Charles Kerr 09bb1a60f0
refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
A Cœur 8857e8c1a4
Declare TR_ETA_NOT_AVAIL as time_t (#4065) 2022-11-03 11:42:42 -05:00
Charles Kerr 611d36ac84
refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
Charles Kerr 210bb03f2f
fix: recent signed-unsigned comparison warnings (#4034) 2022-10-26 11:20:10 -05:00
A Cœur 12e564096b
fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
Mike Gelfand 70f623f32b
Add user data parameter for torrent removal callback (#4009) 2022-10-23 11:51:35 -05:00
Charles Kerr 4a359fd481
refactor: session private fields (#3961)
* 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
2022-10-13 21:25:02 -05:00
Mike Gelfand f1f55cc3df
Sync translations (#3939)
* 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
2022-10-11 18:39:41 +03:00
Charles Kerr 1782dc6d7a
refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
Charles Kerr d17341d784
refactor: constify (#3780) 2022-09-06 12:52:58 -05:00
Charles Kerr 82212ff1d8
refactor: move the verify worker thread into a wrapper class (#3775) 2022-09-05 23:43:59 -05:00
Charles Kerr 6ca0ce683a
refactor: more constexpr (#3744)
Make more simple functions constexpr where possible.
2022-08-31 17:33:51 -05:00
Charles Kerr 291d2fcb9b
fix: when renaming local data files fails, set the torrent error and pause the torrent (#3717) 2022-08-26 18:57:44 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr e49747ab51
feat: add tr_strvToBuf() (#3657)
* feat: add tr_getDefaultConfigDirToBuf()

* feat: add tr_getDefaultDownloadDirToBuf()

* feat: add tr_strvToBuf()

* feat: add tr_torrentFindFileToBuf()

* feat: add tr_torrentGetMagnetLinkToBuf()

* refactor: remove unused makeString() from tests

* feat: add tr_torrentFilenameToBuf()

* feat: add tr_torrentGetTrackerListToBuf()

* chore: remove obsolete comment references to tr_free

* chore: remove unused tr_strdup()

* chore: remove unused forward declarations
2022-08-16 19:28:57 -05:00
Charles Kerr 0fbfed60b1
refactor: make tr_session.speed_limit_Bps_ private (#3645)
* refactor: make tr_session.speed_limit_Bps_ private

* refactor: make tr_session.is_utp_enabled_ private

* refactor: make tr_session.is_prefetch_enabled_ private

* refactor: make tr_session.is_ratio_limited_ private

* refactor: make tr_session.upload_slots_per_torrent_ private

* refactor: make tr_session.peer_id_ttl_hours_ private

* refactor: make tr_session.blocklists_ private

* refactor: make tr_session.umask_ private

* refactor: make tr_session.evdns_base_ private

* fixup! refactor: make tr_session.blocklists_ private

* refactor: make tr_session.default_trackers_ private

* refactor: make tr_session.idle_limit_minutes_ private

* refactor: make tr_session.WebMediator private

* refactor: make tr_session.session_id_ private

* refactor: make tr_session.peer_socket_tos_ private
2022-08-15 12:48:05 -05:00
Charles Kerr a4c1a23fae
refactor: make tr_session.is_incomplete_file_naming_enabled_ private (#3642)
* refactor: make tr_session.is_incomplete_file_naming_enabled_ private

* refactor: make session callback setters constexpr

* refactor: make tr_session.is_port_random_ private

* refactor: make tr_session.desired_ratio_ private

* refactor: make tr_session.is_pex_enabled_ private

* refactor: make tr_session.is_idle_limited_ private
2022-08-14 19:33:28 -05:00
Charles Kerr 44a291ca39
refactor: remove tr_session nonmember functions (#3641) 2022-08-14 14:41:57 -05:00
Charles Kerr 08ec882055
refactor: remove tr_isSession() (#3638) 2022-08-14 09:16:08 -05:00
Charles Kerr ed6ee619a6
refactor: make tr_session.queue fields private (#3634) 2022-08-13 14:56:10 -05:00
Charles Kerr 7c5862a5f5
refactor: remove tr_new, tr_free pt. 1 (#3626)
* refactor: tr_torrentGetMetadataPiece() returns an optional vector

* refactor: use tr_pathbuf in create_temp_path()

* refactor: use tr_pathbuf in win32 create_temp_path()

* refactor: use std::vector in isPeerInteresting()

* refactor: remove tr_new0 from tr_peerMgrPeerStats()

* refactor: remove tr_new0 from rechokeUploads()

* refactor: silence clang nullptr dereference warning

* refactor: make tr_natpmp a C++ class

* refactor: use std::string in tr_log_message
2022-08-11 19:59:58 -05:00
Charles Kerr 3ed6b187bb
refactor: iwyu utils.h (#3583) 2022-08-04 08:44:18 -05:00
Charles Kerr dab81c1af6
fix: readability-inconsistent-declaration-parameter-name warnings in libtransmission (#3572) 2022-08-03 01:15:37 -05:00
Charles Kerr f39826cc59
fix: clang-tidy-15 warnings (#3570)
* fix: bugprone-assignment-in-if-condition warning in tr_bitfield::countFlags()

* fix: bugprone-assignment-in-if-condition warning in tr_watchdir_generic_new()

* fix: bugprone-assignment-in-if-condition warning in torrentRenamePath()

* fix: bugprone-assignment-in-if-condition warning in tr_watchdir_inotify_on_event()

* fix: bugprone-assignment-in-if-condition warning in tr_variantWalk()

* fix: misc-const-correctness warning in TrackerDelegate::getText()

* fix: bugprone-assignment-in-if-condition warning in Session::updateStats()

* fix: performance-unnecessary-value-param warning in discoverThreadfunc()

* fix: clang-analyzer-core.UndefinedBinaryOperatorResult warning in tr_completion::setHasAll()

* fix: clang-analyzer-core.UndefinedBinaryOperatorResult warning in tr_torrentFileCompleted()

* fix: silence clang-analyzer-cplusplus.NewDelete warning when using QPointer

This appears to be a false positive; added NOLINT
2022-08-02 18:34:53 -05:00
Charles Kerr 18e2a04f88
refactor: make sha1, sha256 RAII safe (#3556) 2022-07-31 15:58:14 -05:00
Charles Kerr 78b24b594b
refactor: remove tr_runInEventThread() temp data structs (#3528)
* refactor: remove port_forwarding_data

* refactor: remove "struct rename_data"
2022-07-27 02:07:44 -05:00
Charles Kerr 4f7051fe7f
refactor: make tr_session's directory fields private (#3516) 2022-07-23 02:13:18 -05:00
Charles Kerr 47fe7c47d2
refactor: replace per-torrent callbacks with per-session ones. (#3495) 2022-07-23 01:04:34 -05:00
Charles Kerr 9bf2918ad0
refactor: remove tr_strvPath() (#3509) 2022-07-22 13:07:23 -05:00
Charles Kerr 0da1cbb6ec
fix: 3508 location invalidation (#3511)
* Revert "refactor: remove tr_sessionGetConfigDir() (#3506)"

This reverts commit c50da43ae0.

* Revert "fix: do not leak in tr_getWebClientDir() (#3502)"

This reverts commit 5a75e37033.
2022-07-22 00:52:48 -05:00
Charles Kerr c50da43ae0
refactor: remove tr_sessionGetConfigDir() (#3506)
* refactor: remove tr_sessionGetConfigDir() from GTK client

* refactor: remove tr_sessionGetConfigDir() from daemon

* refactor: remove tr_sessionGetConfigDir()

* refactor: remove tr_getTorrentDir()

* fixup! refactor: remove tr_sessionGetConfigDir()
2022-07-21 20:12:45 -05:00
Charles Kerr da032e3875
refactor: remove unused tr_stat fields (#3493) 2022-07-20 21:54:41 -05:00
Charles Kerr 8ea6b6f6d3
refactor: tr_swarm (#3368)
* refactor: simplify tr_swarmGetStats()

* refactor: make addStrike() a tr_swarm member function

* refactor: make updateEndgame() a tr_swarm member function

* refactor: limit scope of some constexpr values

* refactor: make tr_swarm.is_endgame private

* refactor: make tr_swarm.isAllSeeds() a member function
2022-06-28 01:22:34 -05:00
A Cœur 7f01ee52fe
Set torrent file's metainfo for magnets (#3322) 2022-06-21 16:47:57 -05:00
Charles Kerr 25fdb5805c
refactor: use tr_torrent_id_t (#3314)
* refactor: use semantic type tr_torrent_type_t in libtransmission

* refactor: use semantic type tr_torrent_type_t in gtk client

* refactor: use semantic type tr_torrent_type_t in qt client
2022-06-17 10:43:04 -05:00
Viacheslav Chimishuk 0397176c10
keep labels in order added, rather than alphabetically (#3271) 2022-06-16 17:08:42 -05:00
Charles Kerr 256b436023
fix: clang 15 warnings (#3172)
* fix modernize-macro-to-enum libtransmission warnings

* fix readability-simplify-boolean-expr libtransmission warnings

* fix bugprone-unchecked-optional-access libtransmission warnings
2022-06-01 11:56:59 -05:00
Charles Kerr c0bb2d40f1
refactor: add pathbuf and std::string-friendly helpers to tr_sys file and path funcs (#3118)
* refactor: add sv-friendly tr_sys_dir_create() variant

* refactor: add sv-friendly tr_sys_path_get_info() variant

* refactor: add sv-friendly tr_sys_path_exists() variant

* refactor: add sv-friendly tr_sys_path_remove() variant

* refactor: add sv-friendly tr_sys_path_rename() variant

* fixup! refactor: add sv-friendly tr_sys_path_rename() variant
2022-05-21 20:17:00 -05:00
A Cœur 2e25370cc5
Fix QuickLook (#3001)
* Fix QuickLook symbol not found; add file sort and filesize
2022-05-19 23:07:17 -05:00
Charles Kerr a28b07b390
Revert "refactor: move tr_torrent callbacks to tr_session (#3003)" (#3104)
This reverts commit 27fbfd8da6.

Fixes #3088.
2022-05-16 13:48:43 -05:00
Charles Kerr 27fbfd8da6
refactor: move tr_torrent callbacks to tr_session (#3003)
* refactor: move tr_torrent callbacks to tr_session

* Support tr_sessionSet* (#3044)

Co-authored-by: Antoine Cœur <coeur@gmx.fr>
2022-05-14 10:00:13 -05:00
Charles Kerr 88a0b292d9
fixup: fix fd regression in tr_open_files (#3036)
Fixes #3032.
2022-04-30 23:30:49 -05:00
Charles Kerr 5dbe1f4669
refactor: replace tr_fdlimit with tr_open_files (#3016) 2022-04-28 21:35:47 -05:00
Charles Kerr a400682247
refactor: remove unused tr_torrent fields (#3013)
* refactor: remove unused field tr_torrent.prefetchMagnetMetadata

* refactor: remove unused field tr_torrent.dhtAnnounce6InProgress

* refactor: remove unused field tr_torrent.dhtAnnounceInProgress

* refactor: fold etaULSpeed and etaDLSpeed into one field

* refactor: re-arrange fields to avoid padding
2022-04-28 11:52:07 -05:00
Charles Kerr 7c2477dddf
refactor: reduce field padding in some structs (#3006)
* refactor: use smaller integral types in tr_bandwidth

* refactor: re-arrange tr_torrent fields to avoid padding

* refactor: re-arrange tr_torrent fields to avoid padding

* refactor: re-arrange tr_announcer fields to avoid padding
2022-04-28 08:44:24 -05:00
Charles Kerr bf655a921d
refactor: use smaller integral types in some structs (#3005) 2022-04-27 20:06:51 -05:00
Charles Kerr 304fffa6b3
refactor: intern tr_torrent.bandwidth_group_ (#3000)
Most use cases involve either (a) using the default group or (b) sharing
a group with other torrents. In both cases, using a tr_quark is cheaper
than a std::string.
2022-04-27 10:41:28 -05:00
Charles Kerr ca13842c84
refactor: make tr_torrent::verify_state_ private (#2982) 2022-04-24 22:43:26 -05:00
Charles Kerr 1ebac744a5
build: re-enable cert-err33-c clang-tidy warning (#2968)
* refactor: re-enable cert-err33-c clang-tidy warning

* refactor: use fmt::chrono in transmission-remote

* refactor: use fmt::chrono in transmission-show

* refactor: use fmt::chrono in GTK details dialog

* refactor: use fmt::chrono in tr_session

* refactor: remove tr_localtime_r

* refactor: remove tr_gmtime_r
2022-04-22 14:56:54 -05:00
Charles Kerr 32f854a7cf
refactor: add a tr_port safety class (#2952) 2022-04-21 10:58:13 -05:00
Charles Kerr 345b71ffda
refactor: use std::vector for tr_torrents.removed_ (#2943) 2022-04-18 14:24:20 -05:00
Antoine Cœur 9c0038ac8e
Pause magnet download when "Start when added" is unchecked (#2902)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-04-18 01:03:44 -05:00