Commit Graph

381 Commits

Author SHA1 Message Date
Yat Ho e619718a1e
fix: save sequential download across sessions (#6746) 2024-03-31 15:01:05 -05:00
Charles Kerr d935d364ed
refactor: remove torrent_view virtual class (#6738)
* refactor: remove torrent_view virtual class

* chore: workaround for google-readability-todo warnings

* chore: fix completion tests
2024-03-30 14:45:00 -05:00
Charles Kerr b1b685af3f
refactor: make tr_torrentReqIsValid() private (#6620) 2024-02-18 16:00:13 -06:00
Yat Ho 168d56cefc
perf: restore `3.00` wishlist with cached candidates (#6549)
* feat: rewrite Wishlist to cache candidates

* feat: implement mediator and observers

* feat: rewrite existing tests to work for current implementation

* fix: incorrect block spans for existing tests

* feat: add new tests for new features

* fix: clang shadow warning

* fix: heap-use-after-free in tests

* fixup! feat: rewrite Wishlist to cache candidates

* chore: update comment

* code review: reserve vector memory

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-02-05 00:14:34 -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
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 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
Yat Ho ed4fad9b18
feat: support creating 0 byte files (#6232) 2023-11-28 10:51:13 -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
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
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
Charles Kerr 7e8eca0e96
refactor: make tr_torrent::seconds_[seeding,downloading] private (#6279) 2023-11-22 23:41:12 -06:00
Charles Kerr 65d8ae5357
refactor: add a tr_direction arg to tr_torrent::is_queued() (#6263) 2023-11-16 23:55:29 -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 f8c544397a
refactor: add private helper class CumulativeCount (#6260)
* refactor: CumulativeCounts helper class

* refactor: add private CumulativeCounts helper class for tr_torrent
2023-11-15 18:53:43 -06:00
Charles Kerr ad63c7d77f
refactor: make some tr_torrent fields private (#6259)
* refactor: make tr_torrent::is_stopping_ private

* refactor: make tr_torrent::is_queued_ private

* refactor: make tr_torrent::is_dirty_ private

* refactor: make tr_torrent::is_deleting_ private

* refactor: make tr_torrent::obfuscated_hash_ private

* refactor: demeter
2023-11-15 16:24:33 -06:00
Charles Kerr 0e85befc0f
refactor: Values pt. 3 - use Speed in tr_session (#6235) 2023-11-12 12:30:37 -06:00
Charles Kerr a575be778f
refactor: Values pt. 2 - use Speed in tr_bandwidth (#6234) 2023-11-10 17:12:24 -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 089c438512
ci: bump macos-11 to macos-12 in github actions (#6203) 2023-11-04 12:33:25 -05: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 8ac323d5d6
chore: removed copyright timespans in headers (#4850) 2023-11-01 16:11:11 -05:00
Charles Kerr e27b05bcec
refactor: make class methods private (#6181) 2023-10-30 02:32:29 -04:00
Charles Kerr 237223aeaf
refactor: prefer std::set over QSet (#5703)
* refactor: use std::set instead of QSet in WatchDir.cc

* refactor: use std::set instead of QSet in FileTreeView.cc

* refactor: use std::set instead of QSet in ColumnResizer.cc

* refactor: use std::set instead of QSet in Prefs.cc

* chore: fix rebase error that changed libsmall snapshot

* refactor: more replace QSet with std::set
2023-10-24 21:14:37 -04:00
Charles Kerr 69b293a793
refactor: minor decoupling in peer-mgr (#6155)
* refactor: minor decoupling in peer-mgr

Pass a tr_torrents& and TimerMaker& into the tr_peerMgr and HandshakeMediator
constructors so they can be used directly instead of via tr_session.

No functional changes.

* refactor: in HandshakeMediator, make the session reference const
2023-10-24 15:24:52 -04:00
Charles Kerr 735639c5c7
refactor: make tr_torrent::labels_ private (#6153) 2023-10-23 18:11:28 -04:00
Charles Kerr 682e4f2c2b
refactor: make tr_torrent::any_date_ private (#6148) 2023-10-21 23:23:08 -04:00
Charles Kerr 8f7330523c
chore: remove unused progress arg from tr_torrentSetLocation() (#6147) 2023-10-21 22:33:41 -04:00
Charles Kerr 0457dcb6a8
refactor: make tr_torrent::files_wanted_ private (#6146) 2023-10-21 13:21:05 -05:00
Charles Kerr 8c1291ce8a
refactor: make tr_torrent::unique_id_ private (#6145) 2023-10-20 21:23:14 -05:00
Charles Kerr 9e5c528056
refactor: add tr_torrent::stat() (#6143) 2023-10-20 20:35:59 -05:00
Charles Kerr 4bdb3066d8
refactor: decouple tr_verify_worker from tr_torrent (#6123) 2023-10-19 08:39:34 -05:00
Charles Kerr db96771c80
refactor: add tr_torrent::Error helper class (#6077) 2023-10-08 21:33:34 -05:00
Charles Kerr ce39b01dd2
perf: reduce unnecessary size overhead in tr_torrent struct (#6073) 2023-10-04 21:38:14 -05:00
Charles Kerr 3f7340502f
refactor: add a SimpleSmoothedSpeed helper class (#6072) 2023-10-04 17:40:46 -05:00
Yat Ho 93e8bf7330
fixup! refactor: make tr_torrent idle fields private (#6070) (#6074)
Thanks!
2023-10-04 16:33:04 -05:00
Charles Kerr 68f3c89e3c
refactor: make tr_torrent idle fields private (#6070) 2023-10-03 20:18:55 -05:00
Charles Kerr 917c00e477
refactor: remove tr_torrentStatCached() (#6066) 2023-10-02 14:07:28 -05:00
tearfur 31f2c7aa29
refactor: `tr_torrent.incompleteMetadata` from raw pointer to `std::optional` (#5791) 2023-07-15 15:38:38 -05:00
tearfur ca4cb1a675
fix/cleanups to tr_peerMsgsImpl (#5783)
* fix: correct condition to advertise pex support in ltep handshake

1. Advertise pex support regardless of whether the peer had advertised pex support. No reason to give up an opportunity to advertise pex support just because our direct peer does not support it.
2. Check if pex is enabled in global settings as well.
2023-07-14 10:51:52 -05:00
Charles Kerr 5b38e819da
perf: minor cleanups (#5728)
* refactor: in torrent_metainfo.is_private(), cheaper to return a bool than a bool const&

* refactor: in tr_torrent::id(), cheaper to return an int than an int const&

* refactor: in tr_metainfo_builder.is_private(), cheaper to return a bool than a bool const&

* refactor: break peer_atom.flags2 into separate bools
2023-07-04 19:47:51 -05:00
Charles Kerr 56b27057fd
refactor: add lightweight observable / observer for decoupling (#5716) 2023-07-04 15:47:18 -05:00
Charles Kerr 0d3b321bac
refactor: use snake_case for libtransmission class methods (#5497) 2023-05-05 23:11:05 -05:00
Charles Kerr 9d2507c7e3
refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -05:00
Pierre Dubouilh ebfba686b0
feat: sequential download (#4795) 2023-04-14 11:47:54 -05:00