Commit Graph

16123 Commits

Author SHA1 Message Date
Mike Gelfand d8413493d0
Move Qt client's tr_main() into a separate file (#7076)
Support special (optional) `--` argument to explicitly separate options
from filenames. Support special `---` argument to separate client
arguments from Qt arguments.
2024-08-24 18:15:19 +01:00
T Reardon 7543126789
fix sort order of trackerStats keys within RPC doc (#6946)
* fix sort order of keys within trackerStats

* clarify crypto algo

* Revert "clarify crypto algo"

This reverts commit 25e9accb5f.

---------

Co-authored-by: TR Reardon <reardonia@github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-08-24 08:19:04 -05:00
Yat Ho 62240393ed
feat: configurable client `reqq` (#7030)
* chore: housekeeping

* refactor: raise client reqq value

* feat: allow configuring client reqq value

* feat: expose reqq config in RPC

* test: add new key

* code review: distinguish client vs peer

* docs: fix new config name

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-08-23 21:46:37 -05:00
Yat Ho b0a6bf964c
perf: lazy initialise Diffie-Hellman in handshake (#6949)
* perf: don't generate private key when default constructing DH

* refactor: simplify dh pool code using `small::max_size_vector`

* perf: lazy initialise handshake DH

* fix: tests

* refactor: use `std::optional` instead of `DH::is_dummy()`

* perf: try recycling DH objects in handshake destructor

* fix: don't set `have_read_anything_from_peer_` until all sanity checks are finished
2024-08-23 16:14:45 -05:00
Yat Ho b5b7d7abde
chore: misc WebUI fixes and cleanup (#7037)
* chore: housekeeping

* fix: use `setCurrentPopup` for drag and drop dialogue

* fix: minor typo

* chore: removed unused timer

* fix: correct value in `<input multiple='?'>`

* fixup! chore: housekeeping

* code review: use `URL.canParse()`

* Revert "code review: use `URL.canParse()`"

This reverts commit b1a436031ab154d8075762c91dd67d8c9eb954af.
2024-08-23 15:16:22 -05:00
Cœur 07172d9f4f
refactor: avoid `front()` prior to loop (#7068)
* refactor: avoid `front()` prior to loop

* Update libtransmission/peer-mgr.cc

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

---------

Co-authored-by: Yat Ho <lagoho7@gmail.com>
2024-08-23 10:34:44 -05:00
Yat Ho 3e5a77d176
refactor: remove last byte special case in `tr_block_info::byte_loc()` (#7064)
* refactor: remove last byte special case in `tr_block_info::byte_loc()`

* fix: handle 0-byte file at the end of torrent in fpm

* test: modify test for 0-byte file at the end of torrent

* fix: handle 0-byte file at the end of torrent in `block_span_for_file`
2024-08-22 19:03:14 -05:00
Rukario 10333d23b2
fix: make name and hash readable (#7014) 2024-08-22 18:04:45 -05:00
Cœur d9d87eddd8
Bumping MACOSX_DEPLOYMENT_TARGET to 11.0 (#6911)
* Bumping MACOSX_DEPLOYMENT_TARGET to 11.0

* removing obsolete code and resources

* Add a build action for Transmission.xcodeproj

* removing obsolete code
2024-08-22 15:07:17 -05:00
Alessandro Astone 173c19eb5a
fix: Avoid ambiguous overload when calling Gdk::Cursor::create (#7070)
Since gtkmm 4.15.0 a new overload for Gdk::Cursor::create exists
which creates an ambiguity when passing a string literal.

We can avoid the ambiguity by explicitly constructing a Glib::ustring
from the string literal before calling the method.

https://gitlab.gnome.org/GNOME/gtkmm/-/issues/159
2024-08-21 13:33:36 +03:00
Yat Ho 1e16912ae4
refactor: new `tr_variant` API in `transmission-remote` and other cleanup (#6798)
* refactor: remove `Arguments`

* refactor: replace pointer args with lvalue reference

* refactor: use `uint16_t` for port number

* chore: housekeeping

* refactor: replace `char*` with `std::string_view`

* refactor: simplify argument parsing code

* refactor: use new `tr_variant` API in remote

* chore: rename function to snake_case

* chore: move `break` statements in switches outside of compound statements

* chore: use `std::string` literals

* refactor: extract tor start/stop to `MODE_TORRENT_START_STOP`

* refactor: extract tor actions to `MODE_TORRENT_ACTION`

* chore: iwyu

* fix: msvc build failure

* chore: misc cleanup

* fix: dereference optional

* chore: misc cleanup

* ui: fix minor formatting errors

* fix: remove redundant if branches for response string

* code review: remove `o` prefix for optionals

* code review: add condition clause

* code review: check `left_until_done` instead

* fix: unchecked nullptr

* code review: don't reassign method name

* code review: revert accidentally renaming `addIdArg` to `get_id_arg`

* code review: use `TR_ASSERT` instead of `assert`

* refactor: fix static auto constexpr naming

* code review: assert array size

* code review: assert that `arguments` key exists
2024-08-17 20:04:49 +01:00
Dmitry Rodiontsev fea9a8efb7
docs: fix a link to send-email-when-torrent-done.sh script in Transmission scripts (#7040) 2024-08-14 00:07:59 +01:00
Yat Ho 04c115f79c
fix: accurate timestamp in daemon logs (#7009)
* fix: accurate timestamp in daemon logs

* fix: gtk build errors

* fixup! fix: gtk build errors

* code review: use system_clock typedefs

* code review: use the full buffer for string view

* fixup! fix: accurate timestamp in daemon logs

* code review: limit exposure of `using`
2024-08-13 23:57:52 +01:00
Yat Ho 1ae39f8725
feat: log timestamps in local ISO8601 format (#7057)
* feat: log timestamps in local ISO8601 format

* code review: avoid repeated arguments

* code review: locale-independent decimal point character

* fix: pad sub-second part
2024-08-13 11:16:12 +01:00
Yat Ho 7e2212bfe0
refactor: simplify addrinfo unique_ptr definition (#7060) 2024-08-13 11:12:02 +01:00
Mike Gelfand dbea32809a
Refactor async torrent removal logic (#7059)
* Remove `tr_file_move_strict()`, add param to `tr_file_move()` instead

Also restores proper `local_error` logic to handle null error param.

* Remove unused `moved_files` logic

* Rename the callback type and params to match rename decls

* Add torrent ID param to torrent removal callback

* Remove mutex from torrent removal callback

Torrent IDs aren't reused during the lifetime of the session.

* Move main removal callback logic into a separate method
2024-08-13 06:19:36 +01:00
Lucas Clemente Vella 9fc9daf40d
Fails with an error if data removal was not possible (#6055)
* Do not remove torrent if trashing files failed.

Instead, stop the torrent and sets an error.

* Fixing GTK interface with new file removal behavior.

* C++17 compliant.

* Reverting unrelated change.

* Avoiding allocating unecessary objects.

* Easy review fixes.

* Fixing merge error.

* Adding result callback to tr_torrentRemove().

Using the new callback in Gtk GUI to decide when to remove it from the
interface.

* Reducing indentation level and making the function more readable.

* Using existing Session RefPtr.

* Notifying the client before freeing the torrent in the session.

* Addressing comments and synchronizing callback.

* Moving include.

* Fix constness issue reported by clang-tidy
2024-08-13 05:26:09 +01:00
Yat Ho abfd39065c
chore: bump small (#6976)
https://github.com/alandefreitas/small/pull/46
2024-08-13 03:00:58 +01:00
Cœur 2dcd01df1f
compatibility with libfmt v11 (#6979)
* compatibility with libfmt v11

* bumping fmt from 11.0.1 to 11.0.2
2024-08-13 02:41:05 +01:00
Robin Seth Ekman 0279f37377
fix: silence bugprone-unchecked-optional-access warnings (#6990)
* fix: silence bugprone-unchecked-optional-access warnings

clang-tidy emits bugprone-unchecked-optional-access warning for
`tr_sys_file_lock`. however, this is a false positive: the lines
warned about cannot be reached if the optional does not contain a value.
adding an `assert` silences these warnings.

* Apply suggestions from code review
2024-08-13 01:51:05 +01:00
Yat Ho 35ef8cf7a0
perf: avoid `std::advance` in cache.cc (#7025) 2024-08-13 01:03:02 +01:00
Cœur fe385259cc
Opt-in to secure coding explicitly (#7020) 2024-08-13 01:00:02 +01:00
Cœur e028ee4b1d
bump googletest from 1.14.0 to 1.15.2 (#7031) 2024-08-13 00:58:45 +01:00
Cœur 018fbbf074
bump fast_float from 6.1.1 to 6.1.3 (#7032) 2024-08-13 00:55:51 +01:00
Yat Ho 45696b60d2
fix: `settings.json` default value and docs (#7044)
* docs: fix `message-level` default

* docs: fix `peer-socket-tos` description

* fix: restore `rename-partial-files` default value
2024-08-13 00:47:34 +01:00
Yat Ho 120b2fb6a0
chore: misc formatting updates and fixes (#7049)
* chore: remove redundant `.clang-format` entry for `TR_DEFINE_QUARK`

Left-over from bf41e1487a.

* chore: remove redundant `.clang-format` entry for `API_HEADER_*`

Left-over from f7edcfcb2a.

* chore: drop deprecated options in favour of `PackConstructorInitializers`

* fix: invalid `SpacesInAngles` value

* chore: add comment to forecast a change we need to make in the future

* chore: add trailing comma to prettify lambda
2024-08-13 00:44:39 +01:00
Jason Beck 3e9f5f614a
fix: Qt build missing an icon (#6683)
* Create a new shared location for icons and update qt scripts to package public icons

* Move the Faenza.qrc back to original location

* Revert "Move the Faenza.qrc back to original location"

This reverts commit 963e099d65.

* Replace Faenza to its original location

* Remove attribution for an image that does not exist
2024-07-18 02:12:18 +01:00
Yat Ho fa8be1b981
fix: `tr_variant_serde::parse_json()` bug fixes (#6901)
* perf: avoid unnecessary copying

* fix: set `tr_variant_serde::end_` in `parse_json()`

* test: `tr_variant_serde::end()`

* fix: compensate for innate read cursor offset of `rapidjson::AutoUTFInputStream`

* fix: stop parsing json after parsing a complete json root

This matches the benc parser's behaviour

* fixup! fix: stop parsing json after parsing a complete json root
2024-07-17 02:34:13 +01:00
Mike Gelfand c21ee87eea
Add CI configuration for clang-tidy on Windows (#6997)
* Add CI configuration for clang-tidy on Windows

* Fix issues reported by clang-tidy on Windows

* Workaround clang-tidy defects on Windows

* Fix C-style casts (which clang-tidy didn't report)
2024-07-16 22:13:29 +01:00
Yat Ho e334f3c37f
fix: misc µTP trace log fixes (#6929)
* fix: FTBFS when `TR_UTP_TRACE` is defined

* refactor: log socket address when processing udp packets

* refactor: log details of unexpected UDP packet

* fix: don't unset utp context userdata during shutdown

It is still needed inside `utp_destroy()` when `UTP_DEBUG_LOGGING` is defined.

* code review: lazy evaluate incoming udp packet display name

* code review: move `from_str` out of loop
2024-07-14 11:55:37 +01:00
Yat Ho a92fc3b76e
fix: loading `2.20-3.00` progress from resume (#6896)
* fix: loading `2.20-3.00` progress from resume

* code review: fix always 0
2024-07-14 08:37:43 +01:00
Yat Ho a76a07ae99
chore: misc code cleanups (#6927)
* refactor: avoid repeated subscripting in `announcer-udp.cc`

* chore: remove redundant locking in global ip cache

* chore: misc code cleanup in global ip cache

* fixup! chore: misc code cleanup in global ip cache

* refactor: remove `tr_global_ip_cache::create()`

* refactor: rename `tr_global_ip_cache` to `tr_ip_cache`

* build: sync changes to xcode
2024-07-14 01:37:55 +01:00
T Reardon 7f79cb16ee
chore: clarify DhtPort specific usage (#6963) 2024-07-11 01:42:47 +01:00
Yat Ho 415c0a8aa3
fix: apply alt speed settings on load (#6937)
* fix: apply alt speed settings on load

* refactor: allow forcing `tr_session_alt_speeds::set_active()`
2024-07-11 00:55:34 +01:00
Yat Ho 5e08164742
fix: crash in `tr_torrent::VerifyMediator::on_verify_done()` (#6918)
The crash will happen if the following series of events happened:
1. Torrent verification starts for a `tr_torrent` object.
2. The session thread starts executing `tr_torrentFreeInSessionThread()`, about to free this `tr_torrent` object.
3. `tr_torrent::VerifyMediator::on_verify_done()` queues a lambda that captures a pointer to the `tr_torrent` object.
4. The `tr_torrent` object is freed.
5. The session thread executes the lambda from Step 3, and crashes when dereferencing the dangling `tr_torrent` pointer.
2024-07-10 23:48:54 +01:00
reardonia 24f1e15767
refactor: clarify MSE crypto algo. this is a per-algorithm key, not for crypto generally (#6957)
Co-authored-by: TR Reardon <reardonia@github.com>
2024-07-06 23:25:15 -05:00
Torbjörn Lönnemark ec5296c8dc
fix: restore tr_optind in all getConfigDir branches (#6920)
When the --config-dir/-g option was passed, this bug caused all options
preceeding it on the command line to be ignored.

Also remove the superfluous break statement.

Regression introduced by e49747ab51.
2024-06-15 21:57:46 +01:00
Yat Ho 0f1aaf11e0
docs: fix default value in docs (#6919) 2024-06-15 21:57:22 +01:00
Yat Ho 1f10c50979
ci: bump `clang-tidy` from 14 to 18 (#6923)
* ci: bump `clang-tidy` from 14 to 18

`clang-tidy-14` has been crashing when being run on `peer-mgr.cc` since 96de1706af.

According to https://github.com/llvm/llvm-project/issues/95631, upgrading to `clang-tidy-18` fixes this.

* chore: workaround clang-tidy false positives

* fix: limit nolint comment scope

* code review: try avoiding false positive without nolint
2024-06-15 21:06:37 +01:00
Cœur febfe49ca3
bump miniupnpc to 2.2.8 (#6907)
* bump miniupnpc to 2.2.8

* Avoid build error "ln: include/miniupnpc/.: Operation not permitted"
2024-06-15 00:24:06 +01:00
Cœur ec6112e0b1
fix compile error: no matching function for call to ‘flock::flock‘ (#6908)
* fix compile error with gcc 8.2: no matching function for call to ‘flock::flock(tr_sys_file_t&, const int&)

* #error temp checking which pipelines have XFS

* code review: removing duplicate include

---------

Co-authored-by: yunhai <haihai107@126.com>
2024-06-12 02:34:47 +01:00
niol d42d0f3f3f
build with -latomic on platforms that need it (#6774) 2024-06-04 21:59:13 +01:00
Dzmitry Neviadomski b565e076a9
chore: update older macos build verification workflow to macos-12 (#6883)
* chore: update older macos build verification workflow to macos-12

Manually set Xcode to the version was used in macos-11 runner.

See:
https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#xcode
https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md#xcode

* chore: re-enable macos-12 build verification action

* chore: disable gtk and qt clients explicitly with macos build verification

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
2024-06-03 21:47:51 +01:00
Cœur 489de60222
Remove warning "don't cut off end" (#6890) 2024-06-03 21:46:15 +01:00
Yat Ho 2c2011d40f
fix: update partial file suffix after verifying torrent (#6871)
* fix: only update piece completion if different

* fix: remove return statement from void function

* refactor: add `tr_torrent::has_file()`

* fix: update file suffixes after verifying torrent

* fix: tests
2024-06-01 19:44:01 -05:00
Cœur acee39e15c
refactor: harden idle_seconds (#6834)
* Hardening idle_seconds

* code review: revert "size_t to time_t" because time_t isn't guaranted to be signed in the C spec
2024-06-01 17:41:44 -05:00
Yat Ho 78027a8e5b
refactor: cleanup build for miniupnp (#6665)
* fix: remove redundant/outdated miniupnp cmake definitions

* refactor: simplify miniupnpc includes

* fix path to miniupnp

* fix: Xcode project

* fixup! fix: Xcode project

* code review: Xcode changes from mikedld

* refactor: drop miniupnpc support below `1.7`
2024-06-01 20:10:52 +01:00
Yat Ho efec65050e
fix: don't call `tr_logAddTraceIo` before `tr_peerIo::set_socket()` (#6881)
* fix: add fallback for invalid address display name

* fix: only call tr_logAddTraceIo after `tr_peerIo::set_socket()` is called

* chore: housekeeping

* code review: handle `nullptr` from `inet_ntop()` instead

* code review: remove unclear comment

* code review: dedupe peerIo bandwidth log
2024-06-01 16:23:46 +01:00
Laura Kirsch f3f887c93e
libtransmission: fix copyright header generation (#6874)
This is related to #4850 since libtransmission/mime-types.js generates
libtransmission/mime-types.h and puts it there.
Also add a note that the file is automatically generated for good measure.
2024-06-01 15:39:33 +01:00
Charles Kerr 2b75869c80
fix: cert-err58 warning in declaration of TrayIconName, AppIconName, AppName (#6861) 2024-06-01 10:50:51 +01:00