Commit Graph

378 Commits

Author SHA1 Message Date
tearfur 474a30ab2d
feat: add global IP cache, fix UDP connection failure warnings 2023-05-05 12:17:40 -05:00
Gary Elshaw 2999e71e76
fix: typos in libtransmission tests (#5468) 2023-04-28 18:42:45 -05:00
Mike Gelfand e8fcb025a0
fix: use user-preferred locale (#5444)
* Use user-preferred locale

Previous fix adding `L` format specifier was correct but only fixed half
of the problem, as C++ locale is set up to be "C" by default. GTK client
used to call `setlocale(LC_ALL, "")` to set up user-preferred locale
which only affected C functions and `std::locale` (used by libfmt) was
unaware of those changes.

Apply the fix to all the binaries since they're all doing some sort of
output to the user and calling libtransmission helpers, as well as using
libfmt directly.

* Improve libtransmission's json-test

Set the locale C++ way to avoid any sort of inconsistencies, and also
restore it to the old one once finished testing.

* Improve transmission-show test runner script

Quote outputs to avoid CMake error about `message()` being called with
no arguments. Capture stderr to the same output file. Fallback to `git
diff` if `diff` wasn't found. A few other minor changes.
2023-04-27 09:10:33 -05:00
Charles Kerr 9d2507c7e3
refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -05:00
Charles Kerr 9f8a7a656e
fix: Buffer::Buffer(Buffer&&) bug (#5435) 2023-04-22 16:10:09 -05:00
Charles Kerr 7d86d67bc7
chore: prefer fmt/core.h over fmt/format.h (#5404) 2023-04-16 15:34:19 -05:00
Charles Kerr 9158ae7126
feat: add tr_bitfield::intersects() (#5155) 2023-04-14 18:45:46 -05:00
Charles Kerr ed4919a4f4
feat: Add BufferWriter class (#5154) 2023-04-14 17:08:01 -05:00
Pierre Dubouilh ebfba686b0
feat: sequential download (#4795) 2023-04-14 11:47:54 -05:00
Charles Kerr d63165e8a4
perf: fix wishlist cpu load regression, pt. 2 (#5273) 2023-03-22 10:24:10 -05:00
Cœur c60bb5b834
fix: crash when magnet dn isn't utf-8 (#5244) 2023-03-19 10:36:16 -05:00
Charles Kerr 3aeefec203
chore: remove unused header includes (#5227) 2023-03-14 18:36:15 -05:00
Colin B 59a157ebde
feat: restore support for nonstandard `path.utf-8` (#3454) 2023-03-13 13:58:59 -05:00
Mike Gelfand 3039ff1390
Don't discover tests when cross-compiling w/o an emulator (#5197) 2023-03-11 12:42:56 +00:00
Charles Kerr 033d698306
fix: parsing of ipv6 tracker announce URLs (#5174) 2023-03-07 12:19:12 -06:00
Charles Kerr 39e3e1d87b
fix: increase priority of first and last piece of each file (#5167)
The first and last pieces of a file generally include information needed
by preview generators, so prioritizing those pieces makes life easier
for users or tools that look at files while they're being downloaded.

This worked in 3.00 but isn't present in 4.0.0.
2023-03-06 15:50:19 -06:00
Daniel Kamil Kozar 848212eea1
fix: escaped representation of non-BMP characters when generating JSON (#5096) 2023-03-02 00:55:16 -06:00
Charles Kerr d3273504bd
fix: 5053 old torrent files keep appearing (#5117) 2023-03-01 20:12:19 -06:00
Charles Kerr 211e3fc985
fix: always add `announce` key even when including announce-list (#5106) 2023-03-01 13:10:20 -06:00
fghzxm db118e7998
fix: do not test utils if not building utils (#4946)
Setting `-DENABLE_UTILS=0 -DENABLE_TESTS=1` causes CMake errors due to
tests/utils/CMakeLists.txt referencing
`$<TARGET_FILE:transmission-show>` which is undefined.  Fixed by
including the tests/utils/ directory only if `ENABLE_UTILS` is true.
2023-02-20 23:43:05 -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
Cœur 649fd4d0d2
fix: do not lose magnet links when upgrading from tr3 to 4 (#4840) 2023-02-12 18:10:54 -06:00
Thomas Weißschuh 4dc836f330
tests: expose libtransmission gtests to ctest (#4731) 2023-02-11 11:27:36 -06:00
Daniel Kamil Kozar e0753fedb9
fix: put "private" and "source" inside the metadata "info" key (#4809) 2023-02-10 20:33:24 -06:00
Charles Kerr 42a01068c6
chore: disable flaky unit tests (#4808)
This shouldn't be a long-term fix -- each of these tests should be fixed
instead of disabled -- but they are causing so much noise in CI that I'm
disabling them for now and then they can be re-enabled when fixed.

Fixes #4747.
2023-02-10 17:35:22 -06:00
Charles Kerr 0e5f7f86d7
fix: coverity warnings (#4687)
* fix: minor tr_error leak warning in tests

* fix: socket leak in tr_globalIPv6()
2023-01-29 16:49:59 -06:00
Charles Kerr 948f597d15
refactor: buffer snake case (#4682) 2023-01-27 20:12:09 -06:00
Charles Kerr 862abe909c
fix: bugprone-unchecked-optional-access warnings in tests (#4672) 2023-01-26 10:50:42 -06:00
Charles Kerr 977a190646
fix: msvc warnings (#4651)
* fix: C4189 local variable is initialized but not referenced

* fix: C4706 assignment within conditional expression

* fix: C4018 signed/unsigned mismatch

* fix: warning C4996 High-DPI scaling is always enabled.

* fix: C4996: QApplication::fontMetrics() is deprecated

eed5514eaf
2023-01-23 19:24:52 -06:00
Charles Kerr 43bb4bc1c8
refactor: remove unused declarations from tr-macros.h (#4630) 2023-01-21 17:53:58 -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
Dmitry Antipov acbf483bae
refactor: switch to C++11-compatible tr_wait() from tr_wait_msec() (#4576) 2023-01-12 12:03:14 -06:00
Charles Kerr 8b1290c895
build: remove explicit iconv dependency in libtransmission (#4565) 2023-01-08 22:21:31 -06:00
Charles Kerr 68f6f49c6d
test: fix a couple of recurring CI flakes in TimerTest 2023-01-08 15:28:54 -06:00
Mike Gelfand 57e6b06921
Modernize CMake code (ongoing refactoring) (#4515)
* Use imported CMake target for CURL

* Use imported CMake target for fmtlib

* Use imported CMake target for WideInteger

* Use imported CMake target for FastFloat

* Use imported CMake target for UtfCpp

* Use imported CMake target for Threads

* Use imported CMake target for Iconv

* Use imported CMake target for crypto backend

* Use imported CMake target for GTK

* Use imported CMake target for Qt

* Use imported CMake target for deflate

* Use imported CMake target for libevent

* Use imported CMake target for natpmp

* Use imported CMake target for miniupnpc

* Use imported CMake target for dht

* Use imported CMake target for psl

* Use imported CMake target for libutp

* Use imported CMake target for libb64

* Use include directories from libtransmission target
2023-01-02 16:23:51 +00:00
Mike Gelfand bc380511db
Modernize CMake code (ongoing refactoring) (#4507)
* Reformat CMake code

* Bump minimum CMake version to 3.12

* Add target sources separately via `target_source()`

* Make `tr_win32_app_info()` add target sources on its own

* Don't use `include_directories()`

* Don't use `add_definitions()`

* Limit use of `add_compile_options()`

* Move VDKQueue target declaration to a subdirectory

* Add `tr_disable_source_files_compile()` helper

* Add `tr_target_glib_resources()` helper

* Add `tr_gettext_msgfmt()` helper

* Enable AUTOUIC for Qt client

* Enable AUTORCC for Qt client

* Remove AUTO{MOC,RCC,UIC} source group overrides

* Add `tr_target_idl_files()` helper

* Move source group setup to `tr_qt_add_translation()`

* Add `tr_target_xib_files()` helper

* Prefer `target_sources()` to intermediate variables

* Use explicit visibility versions of `target_*()` commands

* Prefer genexes to conditions in `target_*()` commands

* Add `tr_allow_compile_if()` helper

* Leave only top-level `project()`, remove the rest

* Minor fixups

* Fixup Mac QL plugin install

* Fixup IDE target folders and source groups
2023-01-01 19:49:48 +00:00
Charles Kerr 2b90a5fd55
refactor: possible FTBFS fix on arm7 (#4492)
* refactor: possible FTBFS fix on arm7

* chore: remove tr_rand_int_weak() from crypto-test-ref

* refactor: move tr_rand_int() to header
2022-12-29 10:30:03 -06:00
Charles Kerr ab9e971903
refactor: tr_globalIPv6() returns a std::optional<tr_address> (#4464) 2022-12-25 07:55:51 -06:00
Charles Kerr a3f561bcc0
refactor: add tr_address.is_global_unicast_address() (#4462)
Was previously private to net.cc. Expose here so that we can add tests.

Add tests.
2022-12-24 18:53:50 -06:00
Charles Kerr 092d411663
refactor: tr_rand_buffer(), tr_rand_int() again (#4415) 2022-12-21 09:58:32 -06:00
Charles Kerr 5493ed644e
refactor: use tr_rand_buf() in tr_bandwidth::phaseOne() (#4404) (#4411) 2022-12-19 17:31:24 -06:00
Mike Gelfand e694c3e3a0
Use C++ (not C) warning flags for GTK client (#4395)
Use the opportunity to reduce duplication.
2022-12-18 01:02:03 +00:00
Charles Kerr e6d75a4b77
refactor: tr_peerIo (#4372) 2022-12-16 01:23:12 -06:00
Cœur 669faf7474
Dropped tr_rand_int_weak where possible. (#4271) 2022-12-14 12:21:56 -06:00
Charles Kerr 6f1153cae4
refactor: tr_handshake (#4362) 2022-12-13 19:58:39 -06:00
Charles Kerr 2f6315b649
refactor: tr_handshake lifecycle (#4358) 2022-12-13 11:59:21 -06:00
Charles Kerr 0a69685a4e
refactor: tr_address cleanup (#4338)
* refactor: move tr_tracker_http_announce() helper funcs into their own namespace

* refactor: move tr_globalIPv6() helper funcs into their own namespace

* refactor: move tr_address_is_valid_for_peers() helper funcs into their own namespace

* refactor: make tr_address_compare() a private method

* refactor: rename tr_address::isIPv4() to is_ipv4()

* refactor: use snake_case for tr_address methods

* refactor: make tr_address_is_valid_for_peers() a member function
2022-12-08 20:27:52 -06:00
Charles Kerr 0061e4f9a9
refactor: tr_address::display_name() (#4335) 2022-12-08 16:44:19 -06:00
Charles Kerr 22a3a5db25
refactor: peer-socket pt 2 (#4326)
* refactor: tr_netOpenPeerSocket() now takes a tr_address reference

* refactor: disable copy assignment, copy constructor

* refactor: move log statements to peer_socket constructor
2022-12-06 10:28:28 -06:00
Charles Kerr 9a5d9a0ba2
refactor: tr_peer_socket (#4325)
* refactor: make tr_peer_socket.type private

* refactor: reimplement tr_peerIo::address() as a wrapper around tr_peer_socket::address()

* refactor: remove tr_address, tr_port from tr_peerIo

* refactor: replace tr_netClosePeerSocket() with tr_peer_socket::close()
2022-12-05 18:53:31 -06:00