1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 05:25:52 +00:00
Commit graph

501 commits

Author SHA1 Message Date
Charles Kerr
64d9d57363
chore: fix minor clang-tidy warnings (#6275) 2023-11-21 09:02:03 -06:00
Charles Kerr
76521a1751
refactor: Values pt. 7 - remove tr_formatter_init methods (#6258)
* refactor: initialize libtransmission::Values units in Application::initUnits()

* refactor: use libtransmission::Values instead of Formatter::unitStr()

* refactor: remove Formatter::Size, Formatter:Type

* refactor: use Values::Config to init units in transmission-qt

* refactor: use Values::Config to init units in transmission-mac

* chore: remove unused tr_formatter_foo_init() functions

* chore: make Value::operator+() const

* use Values::Speed, Values::Storage in GTK client

* chore: use snake_case for Formatter methods

* refactor: use Values::Speed in GTK client details dialog

* feat: add Values::Value::is_zero()

* refactor: remove unnecessary UTF8String calls
2023-11-15 22:15:40 -06:00
Charles Kerr
07d96036d9
refactor: Values pt. 6 - remove deprecated API (#6250) 2023-11-14 17:23:51 -06:00
Charles Kerr
4be0dca5ac
refactor: Values pt. 5 - use Values::Speed in Qt client (#6248) 2023-11-13 11:13:17 -06:00
Yat Ho
40fe56f33e
refactor: thread-safe lru-cache and tr_open_files (#6230) 2023-11-11 21:09:23 -06:00
Charles Kerr
a575be778f
refactor: Values pt. 2 - use Speed in tr_bandwidth (#6234) 2023-11-10 17:12:24 -06:00
Charles Kerr
37f01fac4c
refactor: migrate variant api (#6238) 2023-11-10 15:41:32 -06:00
Charles Kerr
36f33c0d30
fix: recent clang-tidy warnings (#6233)
* fix: readability-implicit-bool-conversion warnings in file-piece-map

* fix: clang-analyzer-core.NullDereference warning in on_handshake_done()
2023-11-09 19:13:43 -06:00
Yat Ho
a2e97234d2
refactor: optionally include 0 byte files when computing file offset (#6229) 2023-11-09 16:49:18 -06:00
Charles Kerr
2e32789193
refactor: add libtransmission::Values (#6215) 2023-11-09 08:39:06 -06:00
Charles Kerr
a952a0731f
refactor: remove the tr_error** idiom (#6198)
* refactor: remove the tr_error** idiom

* fix: tr_error::message() is only constexpr in c++20 and up

* chore: silence a couple of g++-12 Wshadow warnings
2023-11-04 11:39:41 -05:00
Yat Ho
a2b547fb50
chore: iwyu (#6201) 2023-11-03 12:03:26 -05:00
Julien
424a9b5e17
chore: cleanup timespans in remaining headers (#6199)
* chore: cleanup timespans in remaining headers

* fix: reverted change in generated file

See https://github.com/transmission/transmission/actions/runs/6744426558/job/18334261137?pr=6199
2023-11-03 08:31:39 -05:00
Cœur
2e7448c9bc
fix: appendSanitizedComponent is too aggressive on non-WIN32 (and not enough aggressive on WIN32) (#6187) 2023-11-03 00:25:42 -05:00
sfan5
aaed2eb26c
feat: sanitize torrent filenames depending on current OS (#3823)
Instead of applying the limitations of the least common denominator (Windows) everywhere.
2023-11-01 15:27:04 -05:00
Charles Kerr
e54b17d92e
refactor: blocklists (#6189) 2023-10-31 19:20:01 -04:00
Mike Gelfand
1c421d6d23
Minor CMake maintainability improvements (#6186)
* Prefer `PROJECT_{SOURCE,BINARY}_DIR` to `CMAKE_` ones

* Extend use of 3rd-party dir vars to reduce duplication

* Fix typo in submodule repo name

* Remove `CURL::libcurl` target fallback

The target is always available since CMake 3.12, which is our current
minimum version.
2023-10-30 20:44:34 +03:00
Dzmitry Neviadomski
c697d95ad3
fix: crash after nullptr dereference in rpcimpl (#6177) 2023-10-30 13:30:10 -04:00
Charles Kerr
eb58996c9f
chore: remove unused tr_announce_list::announce_to_scrape(tr_quark) (#6157)
* chore: remove unused tr_announce_list::announce_to_scrape(tr_quark)

* fixup! chore: remove unused tr_announce_list::announce_to_scrape(tr_quark)

fix test oops
2023-10-24 10:58:01 -04:00
Charles Kerr
8f7330523c
chore: remove unused progress arg from tr_torrentSetLocation() (#6147) 2023-10-21 22:33:41 -04:00
Yat Ho
2130eb941a
refactor: drop jsonsl in favour of RapidJSON (#6138) 2023-10-21 14:00:12 -05:00
Charles Kerr
8c1291ce8a
refactor: make tr_torrent::unique_id_ private (#6145) 2023-10-20 21:23:14 -05:00
Charles Kerr
4bdb3066d8
refactor: decouple tr_verify_worker from tr_torrent (#6123) 2023-10-19 08:39:34 -05:00
Yat Ho
0259edbaf3
fix: json string serializer improperly escaping characters (#6005)
* feat: escape json string according to RFC8259

* fix: do not append newline when json serde is in compact mode

* fix: json tests

1. Use the same locale settings as the apps
2. Added additional test case for a string that are known to be prone to locale issues
3. Removed test for escaping non-BMP characters to UTF-16 escape sequences

* chore: add more test cases to `JSONTest.testUtf8`

* chore: order cases in the same order as RFC8259
2023-10-16 19:36:37 -05:00
Charles Kerr
32a62d85ea
refactor: more tr_variant API (#6057) 2023-10-02 16:18:35 -05:00
Cœur
1722f00777
chore: apply clang-format version 17.0.1 (#6054) 2023-10-01 18:45:52 -05:00
Charles Kerr
6ead147620
refactor: use new tr_variant API in tr_session (#6006) 2023-09-16 08:23:35 -05:00
Yat Ho
85a120faea
feat: add preferred-transport to settings.json (#5939) 2023-09-15 20:23:34 -05:00
Charles Kerr
ebb1b775af
refactor: public tr_session settings API now returns tr_variants (#5983) 2023-09-07 19:05:16 -05:00
Yat Ho
e39045cf69
refactor: tidy up announcer code (#5945) 2023-09-01 16:51:58 -05:00
Charles Kerr
fc4b7ed9f4
refactor: prefer functions return std::string instead of tr_strbuf (#5949) 2023-08-29 21:58:31 -05:00
Charles Kerr
fbfbfac3ae
fix: minor coverity warnings (#5916)
* fix: unchecked return value from tr_variantDictFindInt()

coverity 1541113

* fix: unchecked return value from tr_variantDictFindBool()

coverity 1541112

* fix: copy-instead-of-move in tr_strlower()

coverity 1541092

* fix: use auto& instead of auto in test

coverity 1541084

* fix: logically dead code

coverity 1541065

* fix: copy-instead-of-move in tr_announcer_impl::addTorrent()

coverity 1541062

* fix: unchecked return value of tr_variantDictFindInt()

coverity 1541061

* fix: copy-instead-of-move in FilterBar::Impl::tracker_filter_model_update()

coverity 1541058

* fix: copy-instead-of-move in gtr_window_on_close()

* fix: silence invalid resource leak warning

coverity 1520595

* fix: unchecked return value from setsockopt()

coverity 1518345

* fix: dereference after null check (FORWARD_NULL)

coverity 1517816
2023-08-21 21:59:47 -05:00
Charles Kerr
59c638c63d
refactor: replace tr_variant::is_*() with tr_variant::holds_alternative() (#5930) 2023-08-21 16:16:54 -05:00
Charles Kerr
5837603b6f
refactor: make tr_variant follow RAII (#5923) 2023-08-20 23:15:23 -05:00
Yat Ho
eea7d4d886
refactor: re-organise net.h member functions (#5878) 2023-08-17 22:13:01 -05:00
Charles Kerr
a4d205612a
refactor: add tr_variant_serde (#5903) 2023-08-17 11:02:45 -05:00
tearfur
449549c84f
fix: do not mark peer as not connectable when we are currently connected (#5889) 2023-08-14 16:46:09 -05:00
Zhenyu Qi
8873f2a50c
fix: announce with query replace bug (#5871) 2023-08-13 19:27:55 -05:00
tearfur
27f3a5b82a
fix: announce LDP on listening interface (#5875)
* fix: make sure LDP announces are sent on the listening interface

* fix: add implementation for test mediator

* fix: set SO_REUSEADDR for send socket
2023-08-13 12:04:04 -05:00
Mike Gelfand
c14094f4c9
Use clang-format for qualifier alignment (#5845)
`QualifierAlignment` option is available since clang-format v14 and
works better than our own script.
2023-07-30 16:43:43 +01:00
tearfur
f758cb3597
refactor: avoid code duplication (#5793) 2023-07-17 08:56:57 -05:00
Charles Kerr
a9a6e54858
refactor: make tr_socket_address a class (#5772) 2023-07-12 17:29:47 -05:00
Charles Kerr
f036b7c3bf
perf: use small::max_size_vector in tr_torrentGetMetadataPiece() (#5768) 2023-07-12 07:36:16 -05:00
Charles Kerr
8169d524ea
feat: do not auto-disconnect when a known seed initiates a connection and we are seeding (#5756) 2023-07-08 14:27:31 -05:00
tearfur
5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
tearfur
97da2adbca
fix: spelling mistake in net.h function call (#5739) 2023-07-07 20:13:02 -05:00
Charles Kerr
fdf042d32c
refactor: add tr_compare_3way() (#5742)
* refactor: add tr_compare_3way()

This is a small templated utility function to make libtransmission's
sorting / comparison code more consistent and easier to read.
2023-07-06 18:51:08 -05:00
tearfur
2211086338
fix: conform to libcurl requirements to avoid memory leak (#5702) 2023-07-05 22:05:03 -05:00
tearfur
8543555584
refactor: use std::pair to store socket addresses (#5723) 2023-07-04 20:29:12 -05:00
tearfur
9c17463a80
fix: revert "perf: improve IPv4 tr_address comparison" (#5709)
* Revert "perf: improve IPv4 `tr_address` comparison (#5651)"

This reverts commit 70decc1d9d.

* added tests

* add ipv4 equal test and std header
2023-07-01 09:39:35 -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
Charles Kerr
22bb9e5757
refactor: rename tr_dirSpace() to tr_sys_path_capacity() (#5689) 2023-06-29 10:23:00 -05:00
Charles Kerr
3474a1da58
chore: remove tr_wait(); use std::this_thread::sleep_for() (#5683) 2023-06-29 08:51:39 -05:00
Charles Kerr
fd4a0b1d16
chore: remove unused function tr_env_get_int() (#5682) 2023-06-28 22:04:07 -05:00
Charles Kerr
9afced725a
refactor: remove libtransmission::Buffer (#5676)
* refactor: use StackBuffer in announcer-udp

* chore: update buffer tests

* refactor: remove unused libtransmission::Buffer

superseded by libtransmission::StackBuffer
2023-06-27 19:06:25 -05:00
Charles Kerr
df1adf0e0f
chore: revert small buffer (#5654)
* Revert "perf: use libsmall in libtransmission, pt 3 (#5653)"

This reverts commit 3b03494580.

* Revert "perf: use small in libtransmission (#5650)"

This reverts commit 559f6f0332.
2023-06-22 18:42:48 -05:00
tearfur
41cfdce6fd
refactor: replace some C idioms with C++ ones (#5656)
* tidy up legecy practices

* remove undefined std::ignore usage

* avoid extra function stack level in daemon.cc
2023-06-22 17:58:16 -05:00
tearfur
699b3d8416
perf: use a std::map to store peers in tr_swarm (#5645) 2023-06-22 15:21:44 -05:00
Charles Kerr
3b03494580
perf: use libsmall in libtransmission, pt 3 (#5653)
* refactor: use BufferReader, BufferWriter in peer-socket

* feat: expose GrowthFactor in tr-buffer

* perf: choose better defaults for the peer message buffers

* chore: sync tests

* refactor: use small::map in ActiveRequests::Impl
2023-06-22 00:24:42 -05:00
Charles Kerr
559f6f0332
perf: use small in libtransmission (#5650)
* refactor: reimplement Buffer using small

* refactor: use SmallBuffer in announcer-udp

* refactor: use SmallBuffer in variant-json

* refactor: use SmallBuffer in variant-benc

* refactor: use SmallBuffer in handshake

* refactor: use SmallBuffer in peer-msgs

* refactor: delete move semantics on stack-based buffers
2023-06-21 22:41:09 -05:00
tearfur
64261685d8
fix: use both address + port together as a key for peer lookup (#5619) 2023-06-19 20:26:39 -05:00
Василий Чай
ddac05954b
fix: return error when renaming into existing file (#5563) 2023-06-19 00:30:55 -05:00
tearfur
802619e174
fix: fixes and improvements to global IP query (#5510) 2023-06-11 18:27:01 -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
52b03c2489
refactor: migrate methods to buffer reader (#5533) 2023-05-18 16:56:29 -05:00
Charles Kerr
4fd5f3a490
refactor: use reserve_space() in peer-io (#5532) 2023-05-17 13:57:27 -05:00
Charles Kerr
b9698210ef
refactor: restore part of Buffer::reserve_space() (#5529) 2023-05-16 21:46:41 -05:00
Charles Kerr
2cf9678737
fix: revert buffer reserve space (#5528)
* Revert "refactor: use BufferReader, BufferWriter as function args (#5518)"

This reverts commit c2d48a7d11.

* Revert "fixup! refactor: add BufferReader, BufferWriter::reserve_space() (#5513)"

This reverts commit b08e17beef.

* Revert "refactor: add BufferReader, BufferWriter::reserve_space() (#5513)"

This reverts commit 51fd7056ba.
2023-05-14 17:24:42 -05:00
Charles Kerr
8a1a6dba49
perf: avoid extra heap alloc in block cache (#5522) 2023-05-13 14:16:00 -05:00
Charles Kerr
51fd7056ba
refactor: add BufferReader, BufferWriter::reserve_space() (#5513) 2023-05-12 11:15:15 -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
ea500ecdcd
fixup! feat: add global IP cache, fix UDP connection failure warnings (#5506) 2023-05-08 17:53:25 -05:00
Charles Kerr
0d3b321bac
refactor: use snake_case for libtransmission class methods (#5497) 2023-05-05 23:11:05 -05:00
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