Commit Graph

48 Commits

Author SHA1 Message Date
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 42b09b22df
refactor: reduce utils.h includes (#6431) 2023-12-24 11:02:54 -06:00
Charles Kerr 64d9d57363
chore: fix minor clang-tidy warnings (#6275) 2023-11-21 09:02:03 -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
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
tearfur 5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
Charles Kerr c364abcb6f
chore: misc-include-cleaner (partial) (#5738) 2023-07-06 10:00:07 -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 9d2507c7e3
refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -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 d72cb67cfb
chore: include directory name in libtransmission #includes (#5308) 2023-04-14 14:33:23 -05:00
Julien 4b8cfa2e57
chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
Charles Kerr 7367d465b5
style: use the new paragraph comment style everywhere (#4634) 2023-01-22 13:21:30 -06:00
Charles Kerr 59335eac03
fix: sonarcloud cpp:S6004 (#4270)
reduce scope of variables by using if-based initializer
2022-11-28 21:03:28 -06:00
luzpaz f8203148f0
fix: fix various user facing and non-user facing typos (#3743)
* fix: fix various user facing and non-user facing typos

Found via `odespell -q 3 -S ./third-party,*.po,*.ts -L filetest,inout`
2022-08-31 11:28:54 -05:00
Charles Kerr bbb1ba6ea3
refactor: tr_urlPercentEncode() (#3688) 2022-08-21 08:43:09 -05:00
Charles Kerr aac1ab784d
refactor: replace tr_http_escape() with tr_urlEscape() (#3678) 2022-08-19 14:33:06 -05:00
Charles Kerr 3ed6b187bb
refactor: iwyu utils.h (#3583) 2022-08-04 08:44:18 -05:00
Charles Kerr ec79a2a888
fix: clang-tidy misc-const-correctness warnings (#3529) 2022-07-27 09:03:13 -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 cd592d0091
fix: clang-15 warnings (#3257) 2022-06-11 14:35:08 -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 6cdc7e3828
refactor: remove tr_announce_list::tracker info.announce (#2931) 2022-04-16 15:41:51 -05:00
Charles Kerr 31c65eec1f
refactor: remove tr_strvJoin() (#2896) 2022-04-07 17:26:59 -05:00
Charles Kerr e88ebbc3e5
test: fuzz test tr_magnet_metainfo.parseMagnet() (#2890) 2022-04-06 13:22:08 -05:00
Charles Kerr 6e91136b53
fix: three asan issues (#2851)
* fixup! feat: add support for adding torrents by raw hash values (#2608)

fix array-bounds-read issue found by asan

* fixup! refactor: tr_completion (#2220)

fix array-bounds-read issue in tests fixtures

* fixup! refactor: tr_torrents (#2722)

fix memory leak in torrent-tests
2022-03-31 12:12:54 -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
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 d772824553
fix: sonarcloud code smells (#2623)
* fix: make variable a pointer-to-const

* fix: use init-statement to reduce variable scope

* fix: implicit conversion from long to int

* fix: refactor to not nest more than 3 if|for|do|while|switch statements

* fix: make tr_session::setSocketTos() const

* fix: use array.prototype.some instead of a for loop

* refactor: use nullptr instead of NULL

* fix: oops
2022-02-13 23:44:38 -06:00
Charles Kerr 96178b1a9f
feat: add support for adding torrents by raw hash values (#2608)
* Add support for adding torrents by raw hash values

Co-authored-by: vjunk <vjunk@mail.ru>
2022-02-12 22:16:55 -06:00
Charles Kerr ebb2ab6aee
chore: update license spdx abbreviations (#2582)
Use SPDX license list 3.0 terminology: replace deprecated identifiers
GPL-2.0" and "GPL-3.0" with "GPL-3.0-only" and "GPL-3.0-only".
2022-02-07 10:25:02 -06:00
Charles Kerr 52f6e80a61
test: add tr_torrent_metainfo.infoDictSize() tests (#2535) 2022-01-29 15:37:42 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -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 dfc06fe918
refactor: use std::vector in tr_info (#2386) 2022-01-09 10:55:09 -06:00
Charles Kerr 7068eb66c1
refactor: migrate makeFilename() to tr_magnet_metainfo (#2385) 2022-01-08 21:03:21 -06:00
Charles Kerr 02aa2f46d4
refactor: don't use varargs in tr_error (#2352) 2021-12-27 20:32:22 -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
Charles Kerr dd1379b0b6
refactor: add tr_interned_string (#2332) 2021-12-23 11:16:05 -06:00
Charles Kerr bd68d3a2fd
refactor: use tr_sha1_digest_t everywhere (#2330) 2021-12-21 16:14:15 -06:00
Charles Kerr 2277fde4e0
refactor: prefer tr_strv*() funcs (#2317) 2021-12-15 20:09:46 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -06:00
Charles Kerr 656df477f2
refactor: add tr_announce_list (#2308)
* refactor: add tr_announce_list (#2308)
2021-12-14 14:59:40 -06:00
Charles Kerr 74f367c150
fix: sonarcloud (#2227)
* fix: sonarcloud useless-sequence-of-pointer-operators warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzyMRYbK9dvryvWm8XC\&open\=AXzyMRYbK9dvryvWm8XC

* fix: sonarcloud unused-function warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTE\&open\=AX06Stxd1usi2gyYkPTE

* fix: sonarcloud init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzyMRABK9dvryvWm8Wv\&open\=AXzyMRABK9dvryvWm8Wv

* fix: sonarcloud assignment-in-expression warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXztC8rqIH_lVCrUGWcX\&open\=AXztC8rqIH_lVCrUGWcX

* fix: sonarcloud use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXy-sssdW63O2GMuTBKY\&open\=AXy-sssdW63O2GMuTBKY

* fix: replace-redundant-type-with-auto warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXy-sssdW63O2GMuTBKZ\&open\=AXy-sssdW63O2GMuTBKZ

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzOK_MX7S1ht0f4sjIh\&open\=AXzOK_MX7S1ht0f4sjIh

* fix: use-structured-binding-declaration warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTK\&open\=AX06Stxd1usi2gyYkPTK

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTL\&open\=AX06Stxd1usi2gyYkPTL

* fix: use-structured-binding-declaration warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTP\&open\=AX06Stxd1usi2gyYkPTP

* fixup! fix: use-structured-binding-declaration warning

* Revert "fix: sonarcloud useless-sequence-of-pointer-operators warning"

This reverts commit 26c99e75c6.

cannot convert from 'const _InIt' to 'const rpc_method *'
2021-11-25 16:39:19 -06:00
Charles Kerr f14e741052
fix: some sonarcloud warnings (#2189)
* fix: pass-large-object-by-reference-to-const warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0Gz8ze7dx8i2lkKEvq\&open\=AX0Gz8ze7dx8i2lkKEvq

* fix: use-std-array-instead-of-C-array warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5B-\&open\=AX0L8qcgUnpKTxYiu5B-

* fix: extract-assignment-from-expression

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5CH\&open\=AX0L8qcgUnpKTxYiu5CH

* fix: move-include-directives-to-top

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qlYUnpKTxYiu5CQ\&open\=AX0L8qlYUnpKTxYiu5CQ

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5CK\&open\=AX0L8qcgUnpKTxYiu5CK

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlmBwxvzFbF6whWh\&open\=AX0WPlmBwxvzFbF6whWh

* fix: ensure-move-constructor-is-noexcept

https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlWzwxvzFbF6whWU\&open\=AX0WPlWzwxvzFbF6whWU

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP20jI_aUyxGBxCD\&open\=AX0bZP20jI_aUyxGBxCD

* fix: replace-redundant-type-with-auto

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP0rjI_aUyxGBxCB\&open\=AX0bZP0rjI_aUyxGBxCB

* fix: make-parameter-const

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0gkQqqPDVGqE4PY-io\&open\=AX0gkQqqPDVGqE4PY-io

* fix: use-init-statement

https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rARJbfJ-O-YIDS9xM\&open\=AX0rARJbfJ-O-YIDS9xM

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlmBwxvzFbF6whWh\&open\=AX0WPlmBwxvzFbF6whWh

* fix: explicitly-delete-copy-ctor

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0gkQr6PDVGqE4PY-i4\&open\=AX0gkQr6PDVGqE4PY-i4

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP9wjI_aUyxGBxCF\&open\=AX0bZP9wjI_aUyxGBxCF
2021-11-17 18:17:09 -06:00
Charles Kerr 1ba81938bf
refactor: use std::string_view in benc parser (#2182)
* refactor: use std::string_view to parse benc

* refactor: simplify private parsing API in variant.cc

* chore: remove unneeded includes

* refactor: merge tr_variantFromBenc and tr_variantFromBencFull
2021-11-16 21:29:30 -06:00
Charles Kerr 7693ef69bf
refactor: magnet metainfo (#2124)
* refactor: magnet-metainfo
2021-11-09 20:42:18 -06:00