Commit Graph

5442 Commits

Author SHA1 Message Date
Charles Kerr 0a39cb9302
refactor: migrate tr_crypto C functions to members (#3430) 2022-07-10 21:57:05 -05:00
Charles Kerr 5e4c7f9a1e
refactor: use std::deque for tr_peerIo.outbuf_info (#3428) 2022-07-10 13:51:35 -05:00
Charles Kerr d164343fe7
refactor: remove tr_address_to_string() (#3427) 2022-07-09 20:03:40 -05:00
Charles Kerr 71bc7143b8
Revert "refactor: tr_address cleanup (#3422)" (#3426)
This reverts commit 9a44eeaa27.
2022-07-09 18:44:20 -05:00
Charles Kerr 9a44eeaa27
refactor: tr_address cleanup (#3422)
* refactor: remove tr_address_compare()

* refactor: remove tr_address_to_string()

* refactor: remove NUM_TR_AF_INET_TYPES

* refactor: replace tr_sessionGetPublicAddress with tr_session::getPublicAddress()

* refactor: tr_peerIo() takes tr_address by value

* refactor: replace tr_sessionIsAddressBlocked with tr_session::isAddressBlocked()

* refactor: tr_peerMgrAddIncoming now takes tr_address by value

* refactor: replace tr_address_is_valid_for_peers() with tr_address.isValidForPeers()

* refactor: tr_netOpenPeerSocket takes tr_address by value

* refactor: remove tr_generateAllowedSet()

* refactor: setup_sockaddr takes a tr_address by value

* refactor: tr_netBindTCP() takes a tr_address by value

* refactor: tr_dhtAddNode() takes a tr_address by value

* refactor: remove tr_address_from_string()

* refactor: rename tr_address.isValidForPeers() to .isValidPeerAddress()

* refactor: replace tr_address_from_sockaddr_storage() with tr_address::fromSockaddrStorage()

* refactor: minor cleanup to tr_address::readable()
2022-07-08 13:23:41 -05:00
Charles Kerr 745adf8332
Update libutp to 3.4+ (TRAC-5888) (#3416)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-07-08 10:13:22 -05:00
Charles Kerr e9a7ddf7f9
fix: minor warnings (#3413)
* fix: signed-unsigned comparison warning

* fix: readability-implicit-bool-conversion warning

* fix: signed-unsigned comparison warning
2022-07-05 18:32:30 -05:00
Charles Kerr 9dfb3bf3df
refactor: add tr_peer.canRequest() (#3408) 2022-07-04 13:03:32 -05:00
Charles Kerr 513f4bc91b
fix: assertion failed "s->leftUntilDone <= s->sizeWhenDone" (#3406) 2022-07-04 11:48:54 -05:00
depler 707fce44da
fix_empty_log_windows (#3396)
\
2022-07-04 00:34:39 -05:00
Charles Kerr d62a0bd81e
Instantiate `tr_parseNum()` template using basic types (#3404)
There're places where e.g. `size_t` is used which may or may not match one of
`(u)intXX_t` types.

Authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-07-03 23:28:41 -05:00
Mike Gelfand 142b2a088d
Support wolfSSL 4.6+ (#3398)
* Fix testing against reference crypto implementation

Build would fail on CI if using cyassl/wolfssl or polarssl/mbedtls as a
backend and testing it against reference openssl implementation due to
missing include directories, but only if bundled (non-system) b64 is
used.

* Iniitalize size arguments to `wc_DhGenerateKeyPair`

Despite it not being mentioned in the documentation [1] and v4.6 release
notes [2], the two size parameters became [3] not purely "out", but
"in/out", to avoid potential buffer overflows.

[1] https://www.wolfssl.com/documentation/manuals/wolfssl/group__Diffie-Hellman.html
[2] https://github.com/wolfSSL/wolfssl/releases/tag/v4.6.0-stable
[3] 4364700c01
2022-07-03 14:05:40 +01:00
Charles Kerr e7627dc209
refactor: add tr_peer.requestBlocks() (#3384) 2022-07-02 14:42:16 -05:00
Colin B 5e43731bcf
Ensure hybrid torrents are parsed correctly. (#3388) 2022-07-02 12:16:34 -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 85a7d0e09d
refactor: rename Bandwidth as tr_bandwidth (#3379) 2022-06-29 15:08:58 -05:00
Charles Kerr 88a3149ce4
refactor: add tr_peer.activeReqCount() (#3373)
rename peer_stats.pendingReqs to .activeReqs for consistency
2022-06-28 20:48:39 -05:00
Charles Kerr 5407c89237
refactor: use namespaces in peer-msgs.cc (#3370) 2022-06-28 15:24:39 -05:00
Charles Kerr 8ea6b6f6d3
refactor: tr_swarm (#3368)
* refactor: simplify tr_swarmGetStats()

* refactor: make addStrike() a tr_swarm member function

* refactor: make updateEndgame() a tr_swarm member function

* refactor: limit scope of some constexpr values

* refactor: make tr_swarm.is_endgame private

* refactor: make tr_swarm.isAllSeeds() a member function
2022-06-28 01:22:34 -05:00
Charles Kerr 34788a7eb1
refactor: make tr_peerMgr.timers private std::unique_ptrs (#3366) 2022-06-27 21:15:15 -05:00
Charles Kerr 5841441dd1
fixup! refactor: tr_peerMsgs.percentDone() (#3363) (#3365) 2022-06-27 18:16:08 -05:00
Charles Kerr 81a42c6bb6
refactor: tr_peerMsgs.percentDone() (#3363)
* refactor: add tr_peerMsgs.percentDone()

This moves the `progress` and `have` fields from the `tr_peer` parent
class down into BitTorrent peer subclass, since webseeds by definition
are seeds and have everything.

* refactor: use preferred naming for class members

snake_case for variables, camelCase for methods
2022-06-27 14:12:31 -05:00
A Cœur 7f01ee52fe
Set torrent file's metainfo for magnets (#3322) 2022-06-21 16:47:57 -05:00
Charles Kerr 85c11b7f03
fix: requests across piece boundaries when piece is not a multiple of block_size
Fixes #3324.
2022-06-19 23:08:58 -05:00
Lucas Clemente Vella 42198afc5f
Implement latest version of BEP-7 for HTTP requests (#1661)
* Implement BEP-7 for HTTP announce (fixes #1659)
2022-06-17 20:33:11 -05:00
Charles Kerr 25fdb5805c
refactor: use tr_torrent_id_t (#3314)
* refactor: use semantic type tr_torrent_type_t in libtransmission

* refactor: use semantic type tr_torrent_type_t in gtk client

* refactor: use semantic type tr_torrent_type_t in qt client
2022-06-17 10:43:04 -05:00
Viacheslav Chimishuk 0397176c10
keep labels in order added, rather than alphabetically (#3271) 2022-06-16 17:08:42 -05:00
Charles Kerr d20b77a9ab
refactor: make tr_sessionGetEncryption() const (#3306) 2022-06-15 17:19:24 -05:00
Charles Kerr 34cb56b2af
refactor: remove unused tr_ptrArray class (#3262)
* refactor: remove unused tr_ptrArray class

* fixup! build: add sanitizer CI runs when libtransmission-test changes (#3260)
2022-06-11 21:45:00 -05:00
Dmytro Lytovchenko d34bd0b4d6
refactor: modernize cache.cc (#3108)
* Modernize cache.cc: Convert tr_cache to a class

* Modernize cache.cc: Replaced ptrArray with vector

* refactor: Cache now takes a tr_torrents reference

* refactor: add Key type to Cache

* refactor: avoid std::back_inserter

* refactor: add Cache::flushOldest()
2022-06-11 19:46:30 -05:00
Charles Kerr 57c49437eb
fix: filename too long warning when adding magnet links (#3259)
Fixes #3117.
2022-06-11 15:46:40 -05:00
Charles Kerr cd592d0091
fix: clang-15 warnings (#3257) 2022-06-11 14:35:08 -05:00
Charles Kerr 61c1a0f1e8
feat: add rpc torrentGet.availability (#3252) 2022-06-11 12:06:07 -05:00
Charles Kerr adc105ed2c
fix: deadlock between session and web mutexes (#3251)
Fixes #3242.

Introduced by #2693.
2022-06-10 23:56:43 -05:00
Max Zettlmeißl 7269db2d45
Drop the leading zero for permissions in the settings file. (#3248)
This change has been in the back of my head since I made pull request #2984.
Dropping the zero does not change any of the behaviour.
And this way the format is more familiar to users of the unixoid
octal permissions. Those permissions would not be specified with
a leading zero.
If they were specified with a leading zero, it would mean that some
special permission bits (setuid, setgid or sticky) should be cleared.
Thus removing the leading zero in our settings format removes two
cases of possible confusion.
Additionally the permissions are always padded to three digits to avoid
strangely looking permission strings.
2022-06-10 19:04:34 -05:00
Charles Kerr 00386d03a6
fix: too-small scrape request packets may trip SYN flood detection (#3236)
Fixes #964.
2022-06-08 17:51:54 -05:00
Ilkka 4d888ee8fb
Move function declaration (#3207) 2022-06-05 12:08:58 -05:00
Charles Kerr 8806f9af68
fix: duplicate template instantiation on raspberry pi armv7 (#3200) 2022-06-05 00:01:23 -05:00
Charles Kerr 7f1e12f220
refactor: do not prune peer atoms (#3192)
* refactor; do not prune peer atoms

* feat: improve connectivity check for peer candidates
2022-06-04 10:29:24 -05:00
Charles Kerr c5a73b0a79
refactor: remove peer_atom.shelfDate() (#3187) 2022-06-03 10:09:16 -05:00
Charles Kerr c2cd09d8d7
fix: do not crash when pruning idle peer atoms (#3182) 2022-06-02 10:00:12 -05:00
Charles Kerr 654bc409d7
refactor: remove peer_atom.peer field (#3177) 2022-06-01 22:36:00 -05:00
Charles Kerr 75a7c5f080
refactor: add tr_peerMsgs.networkSocket() (#3175) 2022-06-01 21:33:33 -05:00
FX Coudert f5e6c5b782
fix: minor xcode warnings in macOS client (#3174) 2022-06-01 19:51:09 -05:00
Charles Kerr 9170c0f5fc
fix/unexpected-filehash-warning (#3173) 2022-06-01 16:14:09 -05:00
Charles Kerr 256b436023
fix: clang 15 warnings (#3172)
* fix modernize-macro-to-enum libtransmission warnings

* fix readability-simplify-boolean-expr libtransmission warnings

* fix bugprone-unchecked-optional-access libtransmission warnings
2022-06-01 11:56:59 -05:00
SweetPPro 26ed2a0ec8
fix removal of torrent files with a folder structure (#3151)
* fix removal of torrent files with a folder structure

fix for https://github.com/transmission/transmission/issues/3085 and possibly https://github.com/transmission/transmission/issues/2379
2022-06-01 10:25:06 -05:00
Charles Kerr 84d65d8e61
fix: coverity warnings (#3168)
* fix: uninitialized peer_atom field

* fix: silence inaccurate open-files-test warning

* fix: assertion-is-always-true

asserting unsigned val is >= 0

* fix: unnecessary nullptr check

* fix: nullptr dereference warning
2022-05-31 18:58:20 -05:00
Charles Kerr 1c3d60fcd5
refactor: simplify announceToScrape() (#3167) 2022-05-31 12:12:25 -05:00
Charles Kerr d9f70f51dc
perf: avoid std::string temporaries in sessionLoadTorrent() (#3165) 2022-05-31 10:53:46 -05:00
Charles Kerr d1030b58b1
perf: use std::string_view for compile-time UserAgent (#3161) 2022-05-31 09:28:01 -05:00
Charles Kerr 0097921f42
perf: avoid some unnecessary psl domain strdups (#3160)
We were incorrectly duplicating most domains because the "do we need
to convert before feeding to psl" test incorrectly returned true for
many domains.
2022-05-30 21:55:05 -05:00
Charles Kerr 1fc0e5d0d8
refactor: simplify atom pruning (#3159)
Possible fix for #3153
2022-05-30 14:36:03 -05:00
Charles Kerr d1028510c1
refactor: use std::vector instead of tr_ptrArray in peer-mgr (#3149)
* refactor: make peer_atom.pool a std::vector

* refactor: remove unused tr_ptrArray methods

* refactor: remove unused #include ptrarray.h

* refactor: remove unused tr_ptrArrayRemove()

* refactor: remove unused peer-mgr.cc code
2022-05-27 16:27:47 -05:00
Charles Kerr 992775cfdc
refactor: struct peer_atom (#3147)
* refactor: make peer_atom.blocklisted private

* refactor: make tr_atomAddrStr a member function

* refactor: make atomIsSeed a member function

* refactor: make tr_isAtom a member function

* refactor: make peer_atom constructor

* refactor: make getReconnectIntervalSecs a member function

* refactor: make peer_atom.fromFirst const
2022-05-27 12:19:24 -05:00
Charles Kerr cec2195c78
refactor: tr_peerMgrGetPeers() returns a vector (#3142)
* refactor: tr_peerMgrGetPeers() returns a vector

* chore: iwyu <iterator> for std::back_inserter

* chore: iwyu <vector> for std::vector
2022-05-26 20:29:10 -05:00
Charles Kerr 51760bd5c1
refactor: make tr_peerIoGetAddress() a member function (#3141)
* refactor: make tr_peerIoGetAddress() a member function

* refactor: make tr_peerIo.addr a private field

* refactor: make tr_peerIoIsIncoming a member function

* refactor: make tr_peerIoHasBandwidthLeft a member function

* refactor: make tr_peerIoGetPieceSpeed_Bps a member function

* refactor: make tr_peerIoSupportsFEXT() a member function

* refactor: mark tr_peerIo::supportsDHT nodiscard

* refactor: update naming style for tr_peerIo fields

* refactor: make tr_peerIo.is_seed a private field
2022-05-26 12:17:03 -05:00
Charles Kerr 4f0f3f1c49
refactor: prefer std::vector over raw array in torrentGet() (#3140) 2022-05-26 09:36:00 -05:00
Charles Kerr 46eb379205
fix: ESPIPE "illegal seek" error while seeding (#3137)
* fix: ESPIPE "illegal seek" error while seeding

The root cause is createSocket returning `{}` instead of `TR_BAD_SOCKET`
when we have too many peers in use. This defaulted to fd 0, which wound
up closing stdin.

Commit also includes some const-correctness changes made while tracking
the problem down.
2022-05-25 18:16:15 -05:00
Charles Kerr 26b1a9154e
fix: silence unexpected key warnings in torrent file parser (#3133) 2022-05-24 15:28:02 -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 19db28c04d
perf: faster detection of invalid filenames (#3126)
* refactor: move file_info into tr_torrent_files

* chore: rename files-test as torrent-files-test.cc

* test: add tests for tr_torrent_files::isSubpathPortable()
2022-05-23 17:53:26 -05:00
Charles Kerr 67a078402d
fix: compiler warnings (#3123)
* fix: unused function warning tr_rpc_address_is_valid

* fix: unused variable warning old_byte_pop

* fix: method-can-be-made-static warning assertValidRules

* fix: signed-unsigned comparison warning

* fix: invalid case style warning for KBps

* chore: disable warning for static class member varaible
2022-05-22 21:22:34 -05:00
Charles Kerr c0bb2d40f1
refactor: add pathbuf and std::string-friendly helpers to tr_sys file and path funcs (#3118)
* refactor: add sv-friendly tr_sys_dir_create() variant

* refactor: add sv-friendly tr_sys_path_get_info() variant

* refactor: add sv-friendly tr_sys_path_exists() variant

* refactor: add sv-friendly tr_sys_path_remove() variant

* refactor: add sv-friendly tr_sys_path_rename() variant

* fixup! refactor: add sv-friendly tr_sys_path_rename() variant
2022-05-21 20:17:00 -05:00
Charles Kerr 690cf50e53
perf: tr_sys_path_dirname() returns a std::string_view (#2990)
* refactor: use nodejs impl of path.win32.dirname()

* refactor: use nodejs impl of path.posix.dirname()
2022-05-21 11:10:58 -05:00
A Cœur 2e25370cc5
Fix QuickLook (#3001)
* Fix QuickLook symbol not found; add file sort and filesize
2022-05-19 23:07:17 -05:00
Charles Kerr f71ace588f
fix: assertion failed: task->loc.byte <= task->end_byte (#3109) 2022-05-18 15:49:40 -05:00
Charles Kerr a28b07b390
Revert "refactor: move tr_torrent callbacks to tr_session (#3003)" (#3104)
This reverts commit 27fbfd8da6.

Fixes #3088.
2022-05-16 13:48:43 -05:00
Charles Kerr 2293f4336a
perf: use fast_float to parse floating-point numbers (#3092) 2022-05-16 00:06:17 -05:00
Dmytro Lytovchenko aa502f9312
Modernize blocklist.cc: Rename, move members inside struct (#2010)
* Modernize blocklist.cc to C++

* Modernize blocklist.cc: Renamed BlocklistFile struct and moved IPv4 range struct inside it

 Modernize bandwidth.cc: Review notes; Promote container of blocklists in session to vec of unique_ptrs
2022-05-15 11:32:22 -05:00
Charles Kerr 36e6d4ed07
chore: remove unused header fdlimit.h (#3084) 2022-05-14 11:17:55 -05:00
Charles Kerr 27fbfd8da6
refactor: move tr_torrent callbacks to tr_session (#3003)
* refactor: move tr_torrent callbacks to tr_session

* Support tr_sessionSet* (#3044)

Co-authored-by: Antoine Cœur <coeur@gmx.fr>
2022-05-14 10:00:13 -05:00
Antoine Cœur 5d52da8726
Address format conversion warnings in localizations (#3059) 2022-05-14 00:31:24 -05:00
Antoine Cœur d3e1c83c9b
Address build warnings (#3052) 2022-05-04 18:54:41 -05:00
Antoine Cœur 9069e4c910
Fix TeamCity Code Style (#3045) 2022-05-01 13:06:32 -05:00
Charles Kerr 88a0b292d9
fixup: fix fd regression in tr_open_files (#3036)
Fixes #3032.
2022-04-30 23:30:49 -05:00
Charles Kerr 4cc952f0ca
fixup! fixup! fix: ensure all bytes read / written to file (#2682) (#2780) (#3035)
fix spurious tr_error being set when reading up to eof

Fix error introduced in the previous fixup :P
2022-04-30 18:43:32 -05:00
Charles Kerr c8f5cff564
fixup! fixup! fix: ensure all bytes read / written to file (#2682) (#2780) (#3033)
fix spurious tr_error being set when reading up to EOF.

This regression generated invalid error messages when no error occurred.
2022-04-30 16:57:11 -05:00
Charles Kerr e4221916b1
fix: invalid tr_peerMsgsImpl::prefetchCount value (#3024)
* fix: invalid tr_peerMsgsImpl::prefetchCount value

This count could get corrupted due to imprecise bookkeeping when
processing peers' cancel messages. This PR replaces the field with
a `prefetched` flag in the struct that represents a peer request.

This approach has simpler code, simpler logic, and is harder to break.
2022-04-29 12:44:22 -05:00
Charles Kerr d487a5d8d7
refactor: make tr_swarm.peers a std::vector (#3017) 2022-04-29 08:32:15 -05:00
Charles Kerr 5dbe1f4669
refactor: replace tr_fdlimit with tr_open_files (#3016) 2022-04-28 21:35:47 -05:00
Charles Kerr a400682247
refactor: remove unused tr_torrent fields (#3013)
* refactor: remove unused field tr_torrent.prefetchMagnetMetadata

* refactor: remove unused field tr_torrent.dhtAnnounce6InProgress

* refactor: remove unused field tr_torrent.dhtAnnounceInProgress

* refactor: fold etaULSpeed and etaDLSpeed into one field

* refactor: re-arrange fields to avoid padding
2022-04-28 11:52:07 -05:00
Charles Kerr 5e769fbc55
refactor: make tr_recentHistory a template class (#3012)
This gives more flexibility on the size of the count bins, so we can save space on smaller counts
2022-04-28 10:52:26 -05:00
maxz d8c5c65725
Specify the umask and IPC socket permission as strings. (#2984)
* Support specifying the umask as a string representing an octal number.

* Save the umask as a string representing an octal number.

* Support specifying the IPC socket permission as a string representing an octal number.

* Save the IPC socket permission as a string representing an octal number.

* Add a `base` parameter to `tr_parseNum()` for specifying the radix.
2022-04-28 09:16:19 -05:00
Charles Kerr 7c2477dddf
refactor: reduce field padding in some structs (#3006)
* refactor: use smaller integral types in tr_bandwidth

* refactor: re-arrange tr_torrent fields to avoid padding

* refactor: re-arrange tr_torrent fields to avoid padding

* refactor: re-arrange tr_announcer fields to avoid padding
2022-04-28 08:44:24 -05:00
Charles Kerr bf655a921d
refactor: use smaller integral types in some structs (#3005) 2022-04-27 20:06:51 -05:00
Charles Kerr fca85c2f4d
refactor: add Handshakes helper class in peer-mgr (#3002) 2022-04-27 12:20:55 -05:00
Charles Kerr 304fffa6b3
refactor: intern tr_torrent.bandwidth_group_ (#3000)
Most use cases involve either (a) using the default group or (b) sharing
a group with other torrents. In both cases, using a tr_quark is cheaper
than a std::string.
2022-04-27 10:41:28 -05:00
Charles Kerr a818ac9b13
perf: limit the scope of bitfield assertions (#2994)
Fixes #2830.
2022-04-26 19:51:24 -05:00
Charles Kerr 0025363ede
perf: faster file priorities (#2992) 2022-04-26 11:11:21 -05:00
Charles Kerr ca13842c84
refactor: make tr_torrent::verify_state_ private (#2982) 2022-04-24 22:43:26 -05:00
Charles Kerr aa2bb367ab
chore: iwyu cleanup (#2981) 2022-04-24 20:49:52 -05:00
qu1ck 07dc81170a
Fix fields handling in session-get (#2972) 2022-04-24 14:34:32 -05:00
Charles Kerr d4e1b32e38
fix: corruptin when downloading webseeds (#2978)
Fixes #2909.
2022-04-24 12:46:44 -05:00
Charles Kerr 0a3018d706
refactor: decouple peer limits from fdlimit (#2969) 2022-04-22 16:15:06 -05:00
Charles Kerr 1ebac744a5
build: re-enable cert-err33-c clang-tidy warning (#2968)
* refactor: re-enable cert-err33-c clang-tidy warning

* refactor: use fmt::chrono in transmission-remote

* refactor: use fmt::chrono in transmission-show

* refactor: use fmt::chrono in GTK details dialog

* refactor: use fmt::chrono in tr_session

* refactor: remove tr_localtime_r

* refactor: remove tr_gmtime_r
2022-04-22 14:56:54 -05:00
Charles Kerr ed897f93f2
refactor: remove evbuffer_free_to_str() (#2967) 2022-04-22 13:05:49 -05:00
Charles Kerr 32facb50d7
refactor: prefer tr_pathbuf over tr_strvPath() (#2966) 2022-04-22 11:35:56 -05:00
Charles Kerr 7918113e0b
refactor: partially c++ifiy tr_rpc_server (#2965)
Replace the older C-style API methods to be class methods.
2022-04-22 09:19:20 -05:00
Charles Kerr 3643a8aee5
refactor: prefer std::vector as the default container (#2964) 2022-04-22 08:08:02 -05:00
goldsteinn f823df364e
Refactor: use popcnt in bitfield and cleanup warnings (#2950)
Co-authored-by: Noah Goldstein <goldstein.w.n@gmail.com>
2022-04-22 06:54:35 -05:00
Charles Kerr 4d7d35ad57
fix: heap-buffer-overflow in variant-json (#2963)
Fixes #2953.
2022-04-22 01:28:02 -05:00
Charles Kerr 41cb8cbc91
refactor: add tr_address.readable (#2962) 2022-04-21 18:37:02 -05:00
Charles Kerr a25da4f376
refactor: add tr_address::fromCompact() (#2961) 2022-04-21 17:06:00 -05:00
Charles Kerr a52edbcbbe
refactor: remove tr_announce_list.tiers (#2960) 2022-04-21 15:48:30 -05:00
Charles Kerr 68a43c1684
fix: when loading resume state, load filenames before mtimes (#2958) 2022-04-21 12:07:09 -05:00
Charles Kerr 32f854a7cf
refactor: add a tr_port safety class (#2952) 2022-04-21 10:58:13 -05:00
Antoine Cœur bdac708762
docs: fix various typos and misspellings (#2955) 2022-04-21 09:28:38 -05:00
Charles Kerr 0eb1857c6c
build: re-enable cert str34 c clang tidy (#2946)
* build: add clang-analyzer-deadcode.* to clang-tidy

* build: do not disable cert-str34-c checks in libtransmission
2022-04-19 09:51:25 -05:00
Charles Kerr 345b71ffda
refactor: use std::vector for tr_torrents.removed_ (#2943) 2022-04-18 14:24:20 -05:00
Antoine Cœur 9c0038ac8e
Pause magnet download when "Start when added" is unchecked (#2902)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-04-18 01:03:44 -05:00
Charles Kerr 18da7eb125
refactor: use std::vector<tr_quark> for torrent labels (#2942) 2022-04-18 00:53:48 -05:00
Charles Kerr 3a8cac3914
fix: uninintialized field tr_torrent_files.total_size_ (#2941) 2022-04-17 23:21:18 -05:00
Charles Kerr af49e0f1af
fix: do not load magnet file resume files (#2940) 2022-04-17 21:55:20 -05:00
Charles Kerr fc2f6e9725
refactor: make tr_peerMgr.webseeds a std::vector (#2937) 2022-04-17 17:29:06 -05:00
goldsteinn 9c84e85432
Refactor: Cleanup misc inefficiencies throughout the file (#2933)
Co-authored-by: Noah Goldstein <goldstein.w.n@gmail.com>
2022-04-17 10:54:38 -05:00
Charles Kerr 6cdc7e3828
refactor: remove tr_announce_list::tracker info.announce (#2931) 2022-04-16 15:41:51 -05:00
Charles Kerr ef4fcf7ffd
refactor: remove tr_announce_list.tracker_info.scrape (#2930) 2022-04-16 14:14:18 -05:00
Charles Kerr 2f97655981
refactor: remove tr_url_parsed_t.portstr (#2929) 2022-04-16 13:13:42 -05:00
Charles Kerr 881860ac6f
refactor: remove tr_torrent.magicNumber (#2927) 2022-04-16 10:48:51 -05:00
Charles Kerr f4bb09428b
fixup: more libfmt usage regressions (#2924) 2022-04-15 19:56:16 -05:00
Charles Kerr 2866638e1b
refactor: add tr_torrent_files::move() and remove() (#2919) 2022-04-15 18:39:04 -05:00
Antoine Cœur 4590d172de
meta info piece_size should be maximum UINT32_MAX (#2914) 2022-04-15 00:38:59 -05:00
Charles Kerr 5b6f0a52fd
fixup: minor log string formatting changes (#2913)
* fixup! fix: sonarcloud (#2865)

fix: log time format string

* fix: formatting changes

* fixup! refactor: remove tr_strvJoin() (#2896)

fix: daemon logging

Co-authored-by: Catadropa <catadropa@users.noreply.github.com>
2022-04-13 23:19:18 -05:00
Charles Kerr ec57d10954
refactor: tr_files::hasAnyLocalData() (#2911) 2022-04-13 21:41:06 -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 70fbce71ec
refactor: convert watchdir to C++ (#2899)
* refactor: use new/delete instead of malloc/free

* refactor: use std::string instead of raw c strings
2022-04-09 09:58: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 b256da02e3
refactor: remove unused macros (#2897)
* refactor: remove unused fu nction tr_lowerBound()

* refactor: tr_timerAdd() takes a reference, not a pointer

* refactor: tr_timerAddMsec() takes a reference, not a pointer

* refactor: tr_moveFile() takes a reference, not a pointer

* refactor: tr_wildmat() takes std::string_views

* refactor: remove unused macro TR_GNUC_NONNULL

* refactor: remove unused macro TR_GNUC_PRINTF

* refactor: remove unused macro TR_GNUC_NULL_TERMINATED

* refactor: remove unused macro TR_GNUC_HOT

* refactor: remove unused macro __has_feature

* refactor: remove unused macro __has_attribute

* refactor: remove unused macro TR_DEPRECATED

* refactor: remove unused macro TR_DISABLE_COPY_MOVE
2022-04-07 19:20:29 -05:00
Charles Kerr 31c65eec1f
refactor: remove tr_strvJoin() (#2896) 2022-04-07 17:26:59 -05:00
Charles Kerr ffda5bb68a
refactor: remove tr_strip_positional_args() (#2881)
* refactor: use fmt in gtk/SystemIconTray

* refactor: use fmt in gtk/MakeDialog

* refactor: remove unused tr_strip_positional_args()

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-04-07 08:23:04 -05:00
Charles Kerr f79a75cb21
test: fuzz test tr_variantFromBuf() (#2892)
* test: fuzz test tr_torrent_metainfo.parseBenc()

* fix: better error-checking in benc string parsing

* fix: return benc failure if the parse stack is unbalanced

* fix: stack range error when logging json parse errors

* test: fuzz test tr_variantFromBuf()
2022-04-06 16:39:39 -05:00
Charles Kerr a134445caa
test: fuzz test tr_torrent_metainfo.parseBenc() (#2891)
* test: fuzz test tr_urlParse()

* fix: stack error checking in benc parser

* test: fuzz test tr_torrent_metainfo.parseBenc()
2022-04-06 15:26:13 -05:00
Charles Kerr e88ebbc3e5
test: fuzz test tr_magnet_metainfo.parseMagnet() (#2890) 2022-04-06 13:22:08 -05:00
Charles Kerr eb33b2faf5
fix: tr_clientForId() (#2887)
* fix: memory corruption when parsing negative numbers

* fix: stack-buffer-overflow on escape chars in tr_clientForId

* test: add tr_clientForId() fuzz tests
2022-04-06 12:06:11 -05:00
Charles Kerr 7ff1382503
refactor: remove tr_strcmp0() (#2882) 2022-04-05 12:45:26 -05:00
Charles Kerr 80dd460773
refactor: annotate nodiscard, constexpr, noexcept methods (#2879) 2022-04-04 22:51:56 -05:00
Charles Kerr a71f0c762d
refactor: remove varargs from libtransmission (#2876)
* refactor: do not use va_arg in peer-msgs.cc

* refactor: do not use va_arg in platform.cc

* build: enable cert-dcl50-cpp clang-tidy warning

* refactor: use some tr_pathbuf where sensible
2022-04-04 20:37:12 -05:00
Charles Kerr 68bec3f8e3
refactor: remove tr_snprintf() (#2872) 2022-04-04 13:36:48 -05:00
Charles Kerr 1d7d17396f
refactor: remove tr_snprintf() pt 2 (#2871) 2022-04-03 13:23:00 -05:00
Charles Kerr 76f44b4b6f
fix: sonarcloud (#2868)
* refactor: make this variable const

* refactor: replace redundant type with auto

* refactor: use the nullptr literal

* refactor: replace declaration by structured binding declaration
2022-04-02 17:42:51 -05:00
Charles Kerr 1cc9da26ba
fix: sonarcloud (#2865)
* refactor: implement FileTreeItem::children_ with a std::vector

* fix: std::move should not be called on forwarding reference

* fix: uninitialized scalar variable

* fix: unchecked return value from library

* fix: dereference before null check

* fix: unchecked return value from library

* fix: unchecked return value from library

* fixup! refactor: implement FileTreeItem::children_ with a std::vector

* fix: signed-unsigned comparison in libtransmission tests

* fix: avoid unnecessary copy by using const reference

* fix: function should be declared const

* refactor: use fmt::format to build log timestamps

* fix: use init-statement to reduce variable scope

* fixup! refactor: use fmt::format to build log timestamps

* fix: remove tau_tracker destructor for rule-of-zero

* fix: remove tr_peerIo destructor for rule-of-zero

* Revert "fix: dereference before null check"

This reverts commit cd78967815.

* fix: signed-unsigned comparison in libtransmission tests

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: signed-unsigned comparison in libtransmission tests

* fixup! fix: extract nested code block into separate method

* fix: mark possibly-unused as [[maybe_unused]]

* fix: invalid stack memory reference in tr_found_file_t

* fix: signed-unsigned comparison in libtransmission tests
2022-04-02 09:06:02 -05:00
Charles Kerr 46cc95f72e
refactor: remove unused functions (#2863)
* refactor: annotate nodiscard, constexpr, noexcept methods

* refactor: remove unused tr_blocklistFileExists()

* refactor: remove unused tr_blocklistFileIsEnabled()

* refactor: remove unused tr_ctorGetContents

* refactor: remove unused tr_error_is_set()

* refactor: remove unused tr_handshakeGetAddr()

* refactor: remove unused tr_ctorSetLabels()

* refactor: remove unused tr_http_escape_sha1()

* refactor: remove unused tr_lpdEnabled()

* refactor: remove unused tr_ptrArrayPop()

* refactor: remove unused tr_torrentClearIdleLimitHitCallback()

* refactor: remove unused tr_torrentFindFromHash()

* refactor: remove unused tr_sha1_to_string()

* refactor: remove unused tr_torrents::get()

* refactor: remove unused tr_isEncryptionMode()

* refactor: remove unused tr_isPreallocationMode()

* refactor: remove unused tr_ptrArrayBack()

* refactor: remove unused tr_ptrArrayClear()

* refactor: remove unused tr_torrents::get()

* refactor: remove unused Session::torrentSet()

* refactor: remove unused peer_atom comparison operators

* refactor: remove unused peer_atom::compare()

* refactor: remove unused Qt variantInit(tr_variant*, unsigned)
2022-04-01 21:55:30 -05:00
Charles Kerr ca5799a4a8
refactor: annotate nodiscard, constexpr, noexcept methods (#2862) 2022-04-01 19:48:09 -05:00
Charles Kerr 33cbe33229
refactor: remove varargs from TR_ASSERT_MSG() (#2861) 2022-04-01 18:00:51 -05:00
SweetPPro bfd7797c5e
fix: magnet link metainfo corrupted on restart (#2790) 2022-04-01 15:28:55 -05:00
Charles Kerr 1f15933fda
fix: incorrect magnet size calcuation in tr_completion (#2856) 2022-04-01 08:49:54 -05:00
Charles Kerr e64430941f
refactor: remove tr_strdup_printf() (#2854) 2022-03-31 19:13:37 -05:00
Charles Kerr 98e8d5a3da
fix: getBandwidthGroup use right group (#2853)
Fixes #2828.
2022-03-31 15:07:01 -05:00