Commit Graph

5360 Commits

Author SHA1 Message Date
Charles Kerr 4f7051fe7f
refactor: make tr_session's directory fields private (#3516) 2022-07-23 02:13:18 -05:00
Charles Kerr 47fe7c47d2
refactor: replace per-torrent callbacks with per-session ones. (#3495) 2022-07-23 01:04:34 -05:00
Charles Kerr 445aad56a0
test: add platform tests (#3514)
* test: add tr_getDefaultDownloadDir() tests

this also indirectly tests xdg and homedir

* test: add PlatformTest.defaultConfigDirEnv

* test: add PlatformTest.defaultConfigDirXdgConfig

test: add PlatformTest.defaultConfigDirXdgConfigHome

* test: add PlatformTest.webClientDirEnvClutch

test: add PlatformTest.webClientDirEnvTr

test: add PlatformTest.webClientDirXdgDataHome

* fixup! test: add PlatformTest.webClientDirEnvClutch

fix: win32 breakage
2022-07-22 20:10:02 -05:00
Charles Kerr 9bf2918ad0
refactor: remove tr_strvPath() (#3509) 2022-07-22 13:07:23 -05:00
Charles Kerr 0da1cbb6ec
fix: 3508 location invalidation (#3511)
* Revert "refactor: remove tr_sessionGetConfigDir() (#3506)"

This reverts commit c50da43ae0.

* Revert "fix: do not leak in tr_getWebClientDir() (#3502)"

This reverts commit 5a75e37033.
2022-07-22 00:52:48 -05:00
Charles Kerr c50da43ae0
refactor: remove tr_sessionGetConfigDir() (#3506)
* refactor: remove tr_sessionGetConfigDir() from GTK client

* refactor: remove tr_sessionGetConfigDir() from daemon

* refactor: remove tr_sessionGetConfigDir()

* refactor: remove tr_getTorrentDir()

* fixup! refactor: remove tr_sessionGetConfigDir()
2022-07-21 20:12:45 -05:00
Charles Kerr 5a75e37033
fix: do not leak in tr_getWebClientDir() (#3502) 2022-07-21 17:02:13 -05:00
Charles Kerr bb3871b8b9
fix: silence "couldn't read file" warnings (#3501)
* fix: silence could not read user-dirs.dirs warning

* fix: silence could not read bandwidth-groups warning
2022-07-21 13:22:38 -05:00
Charles Kerr da032e3875
refactor: remove unused tr_stat fields (#3493) 2022-07-20 21:54:41 -05:00
Viacheslav Chimishuk de7986e01d
Add announce-ip and announce-ip-enabled parameters. (#3461) 2022-07-20 14:04:52 -05:00
David Miguel Susano Pinto f8b3514c0e
tr_makeMetaInfo: new anonymize option (closes #3420) (#3452) 2022-07-19 16:48:24 -05:00
Gary Elshaw 99ed472e0b
Change the default number of upload slots from 14 to 8 (#3474) 2022-07-19 10:27:12 -05:00
Charles Kerr 41c0f8885e
fix: limit pad search during encrypted handshake (#3471) 2022-07-18 13:00:26 -05:00
Charles Kerr fb431cb1c1
fix: 3415 assert failure in webseed.requestBlocks (#3470)
Fixes #3415.
2022-07-18 11:40:58 -05:00
Charles Kerr fe91f04351
test: add plaintext & encrypted handshake tests (#3455) 2022-07-16 15:25:44 -05:00
Charles Kerr 2bcab6be7e
refactor: remove tr_dh code (#3443)
Refactor the MSE handshake Diffie-Hellman key code.
2022-07-14 19:54:10 -05:00
Colin B c3db52e310
Fix #3444, support single file hybrid torrents. (#3446) 2022-07-14 13:53:00 -05:00
Charles Kerr ba26e79afe
refactor: decouple tr_handshake (#3435)
Add a shim between the handshake code and the rest of the codebase to 
improve decoupling so that a followup PR can add handshake unit tests. 

The handshake code no longer directly relies on tr_torrent, tr_session, 
tr_dht, or tr_peerMgr.
2022-07-11 18:29:48 -05:00
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