Commit Graph

551 Commits

Author SHA1 Message Date
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