Commit Graph

5324 Commits

Author SHA1 Message Date
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