Commit Graph

6056 Commits

Author SHA1 Message Date
Yat Ho df1dc5812c
fix: restore the `tag` key in RPC response (#6492)
* fix: restore the `tag` key in RPC response

* chore: `tr_rpc_request_exec()` housekeeping

* feat: new tests for RPC tag
2024-01-06 10:40:23 -06:00
Yat Ho 4bb9eab0d0
fix: app defaults should override libtransmission defaults (#6495) 2024-01-06 10:10:14 -06:00
Charles Kerr 646883174b
chore: fix misc-use-anonymous-namespace warnings from clang-tidy (#6488) 2024-01-04 23:12:51 -06:00
Charles Kerr 23eb0ef92d
chore: fix reference to temporary (#6484) 2024-01-04 08:52:08 -06:00
Yat Ho 4cfd9f0c9e
fix: restore `alt-speed-enabled` config parameter (#6483) 2024-01-03 22:58:21 -06:00
Yat Ho dce0d37130
fixup! fix: implement proper download limit for uTP (#6416) (#6481) 2024-01-03 11:27:11 -06:00
Charles Kerr 22cde5d4b9
refactor: use new tr_variant API in rpcimpl (#6456)
* refactor: tr_rpc_request_exec_json takes a std::function callback

* refactor: tr_rpc_request_exec_json callback takes a tr_variant&&

* refactor: use new tr_variant API in rpcimpl.cc

* refactor: tr_rpc_request_exec_json() now takes a const& to the request

* fixup! refactor: use new tr_variant API in rpcimpl.cc

* chore: rename function to tr_rpc_request_exec()

* chore: remove unused DetailsDialog::Impl::build_torrent_ids_variant_list()

* refactor: minor copyediting in rpcimpl.cc getTorrents()

* refactor: split handler methods between sync, async

* refactor: remove unused args_out param from AsyncHandlers

* chore: fix new readability-inconsistent-declaration-parameter-name warning
2024-01-02 22:14:43 -06:00
Yat Ho 10d047005a
refactor: convert `tr_incomplete_metadata` to c++ class (#6383)
* refactor: unset peer BEP-9 support if size hint is invalid

* fix: open torrent file in binary mode

* refactor: move metadata size check to method

* refactor: remove duplicate checks

* refactor: reduce temp variable scope in `parseLtepHandshake()`

* refactor: convert `get_piece_length()` to method

* refactor: convert `tr_torrentSetMetadataSizeHint()` to method

* refactor: convert `tr_torrentGetMetadataPiece()` to method

* refactor: convert `tr_torrentUseMetainfoFromFile()` to method

* refactor: convert `tr_torrentSetMetadataPiece()` to method

* refactor: convert `tr_torrentGetNextMetadataRequest()` to method

* refactor: convert `tr_torrentGetMetadataPercent()` to method

* refactor: add basic framework for MagnetMediator

* refactor: initialise `tr_incomplete_metadata` fields in constructor

* refactor: check metadata transfer completion in `set_metadata_piece()`

* refactor: convert `use_new_metainfo()` and `on_have_all_metainfo()` to methods

* refactor: move parts of `tr_torrent::set_metadata_piece()` into `tr_incomplete_metadata`

* refactor: move parts of `tr_torrent::get_next_metadata_request()` into `tr_incomplete_metadata`

* refactor: move parts of `tr_torrent::get_metadata_percent()` into `tr_incomplete_metadata`

* refactor: hide all `tr_incomplete_metadata` fields

* refactor: move `incomplete_metadata` to private

* feat: add test for `set_metadata_piece()`

* refactor: unify integer types

* refactor: rename `tr_incomplete_metadata` to `tr_metadata_download`

* chore: make clang-tidy happy

libtransmission/torrent-magnet.cc:117:68: warning: comparison of integers of different signs: 'long' and 'const uint64_t' (aka 'const unsigned long') [clang-diagnostic-sign-compare]

* refactor: pass log name to `tr_metadata_download` constructor

* chore: iwyu

* fix: thread-safe `TorrentMagnetTest.setMetadataPiece`

* chore: housekeeping

* Revert "fix: thread-safe `TorrentMagnetTest.setMetadataPiece`"

This reverts commit 2a7fcd93a262888f9f55d542b1a9a2da9ca72cea.

* fix: stop soon instead of stop now in `on_metainfo_completed()`

This is unreachable code now, but if it is ever reached, Transmission
will very likely crash.

* fix: maybe fix OpenBSD test failure
2024-01-02 21:04:17 -06:00
Yat Ho 5000edef01
fix: implement proper download limit for uTP (#6416)
* fix: return read buffer size in libutp read buffer size callback

* refactor: clamp amount of data processed in `can_read_wrapper()`

* chore: housekeeping

* refactor: call `utp_read_drained()` in on-read callback

so that uTP acks can be sent out in a more timely fashion
2024-01-02 00:33:53 -06:00
Cœur 376d806b2e
build: fix libtransmission build on very old cmake versions (#6418)
* Fix libtransmission build requirements

* code review: keeping compatibility with deprecated cmake
2024-01-01 21:58:22 -06:00
Cœur e5e768e2ab
fix: implicit conversion loses integer precision (#6466) 2023-12-31 14:04:26 -06:00
Mike Gelfand 9c4d28dd08
fix: a couple of logging format issues (#6463)
* Fix swapped log args in `do_log_system_error()`

* Fix invalid fmt use in `tr_rpc_server::load()` logging
2023-12-30 08:56:34 -06:00
qu1ck 427d813108
fix: support sequentialDownload in list of RPC torrent-get response keys (#6450) 2023-12-29 09:05:37 -06:00
Charles Kerr 501487b8cf
refactor: remove tr_parse_result enum (#6435) 2023-12-24 18:05:18 -06:00
Charles Kerr 69577ea4b9
fix: invalid TR_TORRENT_TRACKERS env var for some torrents (#6434) 2023-12-24 14:21:56 -06:00
Charles Kerr 5e51fda92e
refactor: remove tr_strlcpy() (#6433)
* refactor: do not use tr_strlcpy() in tr_strratio()

* refactor: do not use tr_strlcpy() in bindUnixSocket()

* refactor: do not use tr_strlcpy() in trackerView()

* chore: remove tr_strlcpy() unit tests

* chore: remove tr_strlcpy()

* chore: remove -DHAVE_STRLCPY from Xcode build

* fixup! refactor: do not use tr_strlcpy() in trackerView()

chore: fix copypaste bug
2023-12-24 13:33:33 -06:00
Charles Kerr 0ef34878de
refactor: remove tr_str_is_empty() (#6432)
* refactor: do not u se tr_str_is_empty() in tr_torrentSetLocation()

* refactor: do not use tr_str_is_empty() in remote.cc

* refactor: do not use tr_str_is_empty() in subprocess-win32

* refactor: remove tr_str_is_empty()
2023-12-24 12:01:49 -06:00
Charles Kerr 42b09b22df
refactor: reduce utils.h includes (#6431) 2023-12-24 11:02:54 -06:00
Yat Ho d2d7987553
refactor: allow explicitly queuing functions in session thread (#6406)
* feat: allow explicitly queuing functions in session thread

* refactor: rename `tr_session_thread`-related functions to snake_case
2023-12-24 08:32:14 -06:00
Charles Kerr 581d9c34cc
fix: gcc-13 warnings pt. 2 (#6404)
* fix: tr_priority_t usage warnings

* build: disable -Wnull-dereference warnings when building GTest

* fix: -Wunused-result warning in tr_spawn_async()

* fix: -Warray-bounds warning in NetTest::compact4()
2023-12-23 10:32:04 -06:00
Yat Ho fe95914558
fix: use correct time to determine write buffer size (#6414) 2023-12-23 09:28:43 -06:00
Yat Ho 7c9e04d035
fix: mark torrent as changed when stopping (#6405) 2023-12-17 23:29:53 -06:00
Charles Kerr 2dea0b5fa2
fix: gcc 13 warnings, pt. 1 (#6400)
* fix: nullptr dereference warnings

* fix: mixed enumerated and non-enumerated warning

* fix: -Wnull-dereference warning in qt/MainWindow.cc

* fix: -Wnull-dereference warning in TorrentFilter::countTorrentsPerMode()

* fix: -Wnull-dereference warning in VariantHelpers::change(TrackerStat&, tr_variant*)

* build: bump google-test from 1.12.1 to 1.14.0

* Revert "build: bump google-test from 1.12.1 to 1.14.0"

This reverts commit 6fdcffa5de.
2023-12-17 12:49:39 -06:00
Yat Ho 8177c883b0
fix: allow stopping torrent during verify again (#6398) 2023-12-17 11:16:48 -06:00
Yat Ho 714411a984
fix: disable RapidJSON SIMD optimisations (#6395)
The minuscule speed increase is not worth the potential bugs and compatibility problems
2023-12-17 09:38:17 -06:00
Mike Gelfand a494da4fea
fix: fill random buffer in chunks with mbedtls crypto backend (#6379)
* adjust crypto unit test to reproduce the issue

* fill random buffer in chunks with mbedtls crypto backend
2023-12-16 19:21:24 -06:00
Yat Ho 4b882b1bad
fix: sometimes stuck magnet metadata transfer (#6364)
* fix: don't check `total_size` against `metadata_size_hint`

* refactor: remove `metadata_size_hint`

* refactor: restart metadata transfer from scratch on failing
2023-12-16 08:47:55 -06:00
Yat Ho 7f2e165c1e
fix: remove unnecessary locking in global ip cache (#6370) 2023-12-16 08:03:33 -06:00
Yat Ho 7fa318c283
fix: mark torrent as changed when setting location (#6355) 2023-12-08 09:38:57 -06:00
Yat Ho 4506d20136
fix: add check for `EWOULDBLOCK` (#6350) 2023-12-07 10:13:34 -06:00
Yat Ho 48f9a2376a
fix: always use location of selected torrents in WebUI set location dialogue (#6337) 2023-12-06 10:10:28 -06:00
Yat Ho bcc81f61c0
fix: create file even if not wanted (#6344) 2023-12-06 09:23:16 -06:00
Cœur 555b249322
documentation fix: create empty files on tr_torrent::start (#6340) 2023-12-05 23:39:24 -06:00
Charles Kerr 56837517b0
refactor: tr_block_info cleanup (#6342)
* refactor: make tr_block_info::init_sizes() private

* refactor: remove unuse tr_file_piece_map::empty()

* refactor: remove tr_file_priorities::reset()

* refactor: remove tr_files_wanted::reset()

* refactor: rename method to tr_file_piece_map::piece_span_for_file()

more consistent naming with tr_block_info

* refactor: rename method to tr_file_piece_map::file_span_for_piece()

more consistent naming with tr_block_info

* refactor: use standard class field order in tr_block_info

* refactor: move CompareToSpan from header to cc file

* refactor: make tr_file_piece_map::reset() private

* refactor: rename method to tr_file_piece_map::file_count()

* refactor: rename method to tr_file_piece_map::byte_span_for_file()

* refactor: constify tr_block_info function args

* refactor: fix more signed vs unsigned
2023-12-05 22:06:27 -06:00
Charles Kerr 3cd66899fe
refactor: remove prefetch (#6332) 2023-12-04 11:45:37 -06:00
Charles Kerr 2e46bad22d
refactor: constify the inout module (#6328)
* refactor: move tr_preallocation_mode info tr_open_files

* refactor: remove unnecessary error nullptr check

* refactor: use snake_case for private method names in inout.cc

* refactor: extract-method get_fd() from read_or_write_bytes()

* refactor: make function args const where possible

* refactor: simplify read_or_write_bytes()

* refactor: make buflen a uint64_t in read_or_write_piece()

* refactor: move tr_torrentStop() logic from read_or_write_piece() to tr_ioWrite()

* refactor: make tr_ioFoo() functions take a const torrent

* refactor: make tr_cache::close_torrent_files() take a tor_id instead of a torrent
2023-12-02 14:16:36 -06:00
Charles Kerr d766050dd8
perf: fewer temporary strings (#6325)
* perf: parse the .resume file contents inplace

* perf: use unmanaged strings in make_torrent_field()

* perf: accept moved strings in tr_error::set()

* perf: use small::vector in tr_peerMsgsImpl::sendPex()

the expected pex size is predictable and fits easily on the stack
2023-12-01 16:48:16 -06:00
Charles Kerr 25d67dd00d
refactor: in tr_announce_list, replace port_and_str with aggregated parsed url (#6323) 2023-12-01 15:48:04 -06:00
Cœur f85c3b6f8d
refactor: omit unnecessary reference in magnet metadata progress (#6311) 2023-11-28 17:52:10 -06:00
Yat Ho ed4fad9b18
feat: support creating 0 byte files (#6232) 2023-11-28 10:51:13 -06:00
Yat Ho 1dca5fe480
chore: minor bandwidth code housekeeping (#6306) 2023-11-28 10:18:38 -06:00
Charles Kerr 1ec6b2b232
refactor: make more tr_torrent fields private (#6305)
* refactor: make tr_torrent::max_connected_peers_ private

* refactor: make tr_torrent::completeness_ private

* refactor: make tr_torrent::mark_edited() private

* refactor: make tr_torrent::mark_changed() private

* refactor: make tr_torrent::start_when_stable_ private

* refactor: make tr_torrent::is_dirty() private

* refactor: make tr_torrent::byte_span() private

* refactor: remove unused non-const version of tr_torrent::metainfo()

* refactor: make tr_torrent::set_dirty() private

* refactor: remove unused tr_torrentStartMagnet()
2023-11-27 23:04:04 -06:00
Yat Ho 5d64c860ea
fix: low priority not working (#6079) 2023-11-27 19:59:26 -06:00
Charles Kerr b00b8dd2fb
refactor: make tr_torrent::on_announce_list_changed() private (#6304) 2023-11-27 16:42:31 -06:00
Charles Kerr 777bdfecf1
refactor: make tr_torrent::queue_position_ private (#6301) 2023-11-27 01:27:57 -06:00
Charles Kerr e14806c409
refactor: c++ify libtransmission's tr_ctor struct (#6295) 2023-11-26 15:43:37 -06:00
Cœur 98b3e819ca
fix: Local variable 'pex' will be copied despite being returned by name (#6300) 2023-11-26 11:27:40 -06:00
Charles Kerr a12ef941e7
refactor: make tr_torrent fields, methods private where possible (#6293) 2023-11-25 20:00:20 -06:00
Yat Ho 7af71d9695
refactor: pause torrent after verifying if files disappeared (#6277) 2023-11-25 16:20:17 -06:00
Charles Kerr d8c2074cb7
refactor: make tr_torrent date fields private (#6281) 2023-11-23 19:52:53 -06:00