49 Commits

Author SHA1 Message Date
Yat Ho
095bad6568 fix: check if piece is wanted upon receiving block (#7866)
* fix: check if piece is wanted upon receiving block

* test: block_last_loc
2025-12-08 15:43:56 -06:00
Yat Ho
47eb4ee2bc refactor: dedicated class for torrent queue (#7332)
* Revert "feat: save queue order between sessions (#6753)"

This reverts commit 4db50dae10.

* refactor: new torrent queue class

* refactor: replace queue code with new class

* test: new tests for new class

* feat: store and load queue order across sessions

* build: xcode

* refactor: use set_difference instead of unordered_set

* code review: use `tr_torrent_id_t` as key

* fix: don't overflow when moving up/down

---------

Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>
2025-03-09 19:08:50 -05:00
Charles Kerr
d1a1a0adae fix: clang-tidy header warnings, pt. 1 (#7228)
* fix: warning: deleted member function should be public [modernize-use-equals-delete]

* fix: warning: variable has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]

* fix: warning: enum uses a larger base type than necessary for its value set [performance-enum-size]

* fix: warning: initializer for member is redundant [readability-redundant-member-init]

* warning: parameter is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
2024-11-17 20:04:55 -06:00
Yat Ho
9748f42c5a fix: restore portable file path check (#6853)
* chore: change to snake_case naming

* fix: restore portable file path check

* fix: macosx build
2024-05-25 10:08:53 -05:00
Yat Ho
152f3e91a5 refactor: convert tr_peerMsgsImpl helper functions to class methods (#6580)
* refactor: update bep links

* chore: use more appropriate data types

* chore: checkpoint

* refactor: split `can_request()` into each of their own different signature

* chore: checkpoint

* refactor: convert tr_peerMsgsImpl functions to methods

* chore: checkpoint

* refactor: store peer info as reference

* refactor: convert all member variables to private

* chore: re-arrange methods

* refactor: optimise tmp vector default size in `send_ut_pex()`

* chore: housekeeping

* chore: housekeeping

* refactor: avoid `dynamic_cast` when sending cancel

* fix: restore `blocks_sent_to_peer` stat

regression e91af26923

* fix: choke first then reject

* refactor: convert `tr_peerMsgsNew()` to static factory function

* refactor: store `tr_torrent` reference instead of pointer

* Revert "refactor: store peer info as reference"

This reverts commit bb419bf2

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-03-15 19:52:09 -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
fc4b7ed9f4 refactor: prefer functions return std::string instead of tr_strbuf (#5949) 2023-08-29 21:58:31 -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
9d2507c7e3 refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -05: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
Julien
4b8cfa2e57 chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
Charles Kerr
724a0f48f0 fix: clang-tidy header warnings (#4686) 2023-01-28 17:58:20 -06:00
Charles Kerr
c75f9a4a7a refactor: tidy libtransmission symbol visibility (#4680) 2023-01-27 14:25:08 -06:00
Cœur
c89edcd1f6 underscores in documentation comments should be code escaped (#4639) 2023-01-23 10:26:11 -06:00
Charles Kerr
1402cb2949 refactor: add TR_CONSTEXPR20 to make future C++20 migration easier (#4457) 2022-12-23 15:21:40 -06:00
Charles Kerr
09bb1a60f0 refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
Charles Kerr
6ca0ce683a refactor: more constexpr (#3744)
Make more simple functions constexpr where possible.
2022-08-31 17:33:51 -05:00
Charles Kerr
ea05474464 perf: make methods constexpr (#3742) 2022-08-30 23:17:23 -05:00
Charles Kerr
83ffa6bf1b chore: fix spdx abbreviations (#3602) 2022-08-08 13:05:39 -05:00
Charles Kerr
dab81c1af6 fix: readability-inconsistent-declaration-parameter-name warnings in libtransmission (#3572) 2022-08-03 01:15:37 -05:00
Charles Kerr
bf8f72e61f refactor: tr_metainfo_builder() (#3565) 2022-08-02 14:46:08 -05:00
Colin B
3237323b8e Add basic support for v2 hashes in transmission-show (#3380)
* Add basic support for v2 hashes in transmission-show

* Add sha256 for more libraries

* Fix issue with sha256 digest length
* Add sha256 for polarssl
    Note: Bumping miniumum PolarSSL version to 1.3 because of
    sha2->sha256 name change.
* Add sha256 for CommonCrypto/ccrypto
* Add sha256 for cyassl
2022-07-01 09:49:33 -05:00
Charles Kerr
fe288b45e5 perf: do not use tr_variant when parsing .torrent files 2022-05-23 23:05:16 -05:00
Charles Kerr
2866638e1b refactor: add tr_torrent_files::move() and remove() (#2919) 2022-04-15 18:39:04 -05:00
Charles Kerr
9f9f60f1e3 refactor: tr_block_info (#2908) 2022-04-13 20:22:59 -05:00
Charles Kerr
4a65956cc9 refactor: extract some file management into tr_files class (#2906) 2022-04-12 10:00:02 -05:00
Charles Kerr
205abbbcce refactor: iwyu string, vector, cstdint (#2898)
* refactor: use cstdint for intX_t types

* refactor: iwyu sstring_view

* refactor: iwyu <cstring>

* refactor: iwyu <vector>
2022-04-07 20:50:26 -05:00
Charles Kerr
80dd460773 refactor: annotate nodiscard, constexpr, noexcept methods (#2879) 2022-04-04 22:51:56 -05:00
Charles Kerr
ca5799a4a8 refactor: annotate nodiscard, constexpr, noexcept methods (#2862) 2022-04-01 19:48:09 -05:00
Charles Kerr
66638cc80c test: fix race condition in move-test (#2841) 2022-03-30 01:30:39 -05:00
Charles Kerr
2996e223dd refactor: strbuf for metainfo files (#2833)
* refactor: tr_ctorSaveContents takes a string_view filename

* refactor: remove tr_ctorSaveMagnetContents

* refactor: announce_list::save takes a std::string_view

* refactor: magnet() takes an OutputIt arg

Generate the magnet link URL into an output iterator

* refactor: remove deprecated calls to tr_http_escape

* refactor: tr_torrent.torrentFile takes an OutputIterator

* refactor: tr_torrent.torrentFile returns a tr_pathbuf

* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf

* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -05:00
Charles Kerr
44e30bf092 perf: avoid excess filesystem checks (#2786) 2022-03-18 16:31:25 -05:00
SweetPPro
943b57979f support for resuming magnet links (#2702)
* support for resuming magnet links

magnet links are now saved as a text file the `Torrents` folder as `.magnet` files.
2022-02-24 15:52:29 -06:00
Charles Kerr
13ad2b58dc refactor: always use a blocksize of 16 KB (#2694)
Fixes #99.
2022-02-23 14:25:06 -06:00
Charles Kerr
78ad90a4c5 refactor: use tr_block_info::Location in inout.cc (#2658) 2022-02-19 10:07:08 -06:00
Charles Kerr
f88f3c4b03 Feat: add tr_block_info::Location (#2649) 2022-02-18 17:17:19 -06:00
Charles Kerr
52f6e80a61 test: add tr_torrent_metainfo.infoDictSize() tests (#2535) 2022-01-29 15:37:42 -06:00
Charles Kerr
e51527203e refactor: re-enable clang-tidy warnings (#2485) 2022-01-23 16:47:41 -06:00
Charles Kerr
df1cca9b57 chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr
8d75736ad1 fix: empty torrent filename (#2435)
fix torrents readded due to unremoved cfg files.
2022-01-17 23:14:00 -06:00
Charles Kerr
aa2183c9c5 fix: torrents readded due to unremoved cfg files (#2433)
Fixes #2430.

When removing a torrent, try to remove config filenames under both old
and new filename formats. This prevents torrents from being incorrectly
re-added when old-format files aren't removed.
2022-01-17 20:36:41 -06:00
Charles Kerr
6b440af32f fix: potential out-of-range error in io's readOrWritePiece() (#2413) 2022-01-16 12:02:47 -06:00
Charles Kerr
db23ca4c6b refactor: replace tr_info with tr_torrent_metainfo (#2397)
* refactor: replace tr_info with tr_torrent_metafo
2022-01-15 13:33:57 -06:00
Charles Kerr
b0ee4007ff refactor: include cleanups (#2392)
* refactor: include <memory> when using shared_ptr or unique_ptr

* refactor: include <cstdio> iff we use it

* refactor: include <cstring> iff we use it

* refactor: include <cstdlib> iff we use it

* refactor: include <string_view> or <string> iff we use it

* refactor: include <array> iff we use it

* refactor: include <ctime> iff we use it

* refactor: include <cctype> iff we use it

* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr
8b65b660c8 refactor: use std::string in tr_file (#2382) 2022-01-08 12:53:35 -06:00
Charles Kerr
385a119fb1 refactor: make tr_torrent aggregates tr_block_info instead of subclassing (#2376) 2022-01-07 13:13:37 -06:00
Charles Kerr
7c87cb36eb refactor: tr_torrent_metainfo (#2340)
* refactor: add tr_torrent_metainfo class

Can be used for parsing bencoded .torrent data without instantiating
a tr_torrent. This will be used in all the places where client code
needs to test a .torrent file for validity / to add a preview window
before adding the torrent.
2021-12-25 15:21:13 -06:00