Commit Graph

378 Commits

Author SHA1 Message Date
Charles Kerr 468310300c
refactor: only need a single handshake mediator (#4322) 2022-12-05 11:47:11 -06:00
Charles Kerr 728e5b8350
refactor: stop tracking peerIo creation time (#4300) 2022-12-02 10:39:46 -06:00
Charles Kerr 595d0ac14a
refactor: add tr_announcer.startShutdown() (#4280) 2022-11-29 21:05:11 -06:00
Charles Kerr 8085ef6acb
fix: flaky subprocess tests (#4266) 2022-11-28 16:45:18 -06:00
Charles Kerr ec6cb67c5c
fix GTK client message log window does not restore level selection (#4242)
* fix: save log level, encryption mod, preallocation mode as ints

* fix: ensure log level is saved in tr_sessionGetSettings()

* fix: ensure the right verbosity row is selected
2022-11-26 07:32:51 -06:00
Charles Kerr 8a35aa0903
refactor: add tr_rand_obj() (#4238)
* refactor: add tr_rand_obj()

There are a lot of places in the codebase where we need to populate
an integral type or a fixed-size array with random data. To do this,
we instantiate a local on the stack, fill it with tr_rand_buffer(),
and then use it.

This PR creates a helper function to make this a one-liner.
2022-11-25 15:04:37 -06:00
Charles Kerr 554ba06ae2
fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
Charles Kerr 19bc15523f
fix: new sonarcloud, coverity, gcc warnings (#4229) 2022-11-23 13:47:04 -06:00
Charles Kerr a8f2b840f7
perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
Herman Semenov ffd5e6bf50
refactor: remove unused vars, code simplify and minor optimize (#4172) 2022-11-19 09:46:03 -06:00
Charles Kerr d27c4c59ce
refactor: incremental announcer refactor pt. 2 (#4214) 2022-11-18 23:00:25 -06:00
Charles Kerr 4cc0b77eec
refactor: incremental announcer improvements (#4211) 2022-11-17 20:23:54 -06:00
Charles Kerr 42f26aad0b
fix: ftbfs on Windows (#4204) 2022-11-16 18:03:48 -06:00
Charles Kerr a45cc2a79d
refactor: try again to use getaddrinfo in announcer_udp (#4201) 2022-11-16 15:13:31 -06:00
Charles Kerr d2125ee965
perf: revert e065565cd to restore async dns lookups (#4182) 2022-11-15 11:16:49 -06:00
Charles Kerr d0639b5f0c
perf: tr_sys_path_basename() returns a std::string_view (#4176) 2022-11-15 08:29:00 -06:00
Charles Kerr 5cb9e8c146
test: increase timer interval in TimerTest.repeatingThenSingleShot (#4173)
These 25ms timers are not repeatable enough on the CI boxes
2022-11-14 18:04:15 -06:00
Charles Kerr 8df26dd2fc
refactor: re-enable some clang tidy warnings in tests (#4170) 2022-11-14 14:16:29 -06:00
Mike Gelfand 43acd7e3e4
Remove Xcode project in favor of CMake (#4147)
* Compile images into an assets catalog

* Optionally sign resulting Mac bundle

* Move 3rd-party/utility/test targets to their own folders

* Enable ARC via compile options unconditionally

* Install base and localized resources into correct directory

This seems like a Xcode quirk: if subdirectory containing the resource file
matches the destination directory name (and probably if there's more than one
resource file being installed there), the resulting folder structure then
contains an extra subdirectory, i.e. Resources/dirname/dirname/resname.

* Group source files for better structure in IDEs (Xcode, VS)

* Remove Xcode project

Using Xcode is still possible via "Xcode" CMake generator.

* Use ad-hoc signature if one is not specified

* Always use ad-hoc signature on link, leave proper signing to CPack

* Install localized resources into correct directory (QL plugin)

* Don't include CTest (we don't use additional targets it provides)

* Revert "Remove Xcode project"

This reverts commit dc069f654f.
2022-11-12 20:01:57 +00:00
Charles Kerr 250e055c1d
fix: warnings from clang tidy sonarcloud coverity (#4143) 2022-11-12 09:53:09 -06:00
Charles Kerr 9e06cf8f2e
refactor: make DHT unblocking (#4122) 2022-11-11 10:09:24 -06:00
Charles Kerr 2d2270c7d9
fix: thread-sanitizer warnings in SandboxedTests (#4131) 2022-11-09 23:56:08 -06:00
Charles Kerr ab78759233
test: add libtransmission::Timer tests (#4121) 2022-11-08 16:20:21 -06:00
Charles Kerr 36edd516aa
refactor: replace tr_boundinfo with tr_session::BoundSocket (#4103) 2022-11-06 10:35:48 -06:00
Charles Kerr 831eb8d40f
refactor: make `tr_session_thread` a unique_ptr owned by tr_session (#4069) 2022-11-04 16:20:27 -05:00
Charles Kerr e065565cd4
reafctor: use getaddrinfo() instead of evdns (#4094) 2022-11-04 13:29:56 -05:00
Charles Kerr ee8a6bd130
refactor: simplify blocklist code (#4086) 2022-11-03 15:46:27 -05:00
Charles Kerr 611d36ac84
refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
A Cœur 14f2698cdc
Remove tr_generateAllowedSet declaration (#4029) 2022-10-25 08:50:53 -05:00
Charles Kerr b32f3e0a24
refactor: add tr_address::toCompact() (#4014)
* refactor: add tr_address::toCompact()

* test: use the theory.org compact ipv4/6 examples in NetTest.compact4, NetTest.compact6

* refactor: add tr_address::toCompact()

* test: add toCompact, fromCompact tests

* refactor: add compact <--> sockaddr_storage conversion
2022-10-24 13:40:12 -05:00
Mike Gelfand 70f623f32b
Add user data parameter for torrent removal callback (#4009) 2022-10-23 11:51:35 -05:00
Charles Kerr d191a04228
refactor: decouple tr_announcer_udp (#4002) 2022-10-21 13:15:14 -05:00
Charles Kerr 450f1dcadc
refactor: extract `tr_buffer` class from `tr_peerIo` (#3986) 2022-10-19 11:42:08 -05:00
Charles Kerr 7ee76a604d
feat: add libtransmission::Dns.cached() (#3984) 2022-10-17 20:17:01 -05:00
Charles Kerr c8e652c820
refactor: add dns interface class (#3977) 2022-10-17 14:41:42 -05:00
Charles Kerr 79068c512a
refactor: decouple tr-dht from peerMsgs, peerMgr (#3966)
* refactor: decouple peer-mgr from tr-dht

* refactor: remove tr_dhtPort()

* refactor: decouple peer-msgs from tr-dht

* refactor: make tr_udp_core.udp_port_ const

* refactor: rename tr_udp_core::dhtUninit() as startShutdown()
2022-10-15 08:22:43 -05:00
Charles Kerr 572e1bb50f
refactor: add tr_address::fromSockaddr() (#3964)
* refactor: remove TR_DISCARD_ALIGN

* refactor: add tr_address::fromSockaddr()
2022-10-14 01:20:39 -05:00
A Cœur 4ea9c87fea
fix: some typos (#3904) 2022-10-13 09:35:10 -05:00
Dzmitry Neviadomski ecc7c185a4
tests: Fix SubprocessTest on macOS Monterey and later. (#3812)
On macOS Monterey and later `/var` is symlinked to `/private/var`

Add missing `tr_sys_path_resolve(...)` for parent dir in sandbox
fixture.

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
2022-10-08 22:18:39 +03:00
Charles Kerr 89d6533cd7
build: support semver versioning (#3867)
* build: semver versioning

Xref: https://github.com/transmission/transmission/issues/1037

* test: add base62 tests for client-id

* build: include PATCH_VERSION in Transmission.rc.in

* build: semver versioning in version.h

* fixup! build: semver versioning in version.h

undo experimental verison changes that were made for testing purposes

* Fixup version in MSI package filename

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-10-05 16:53:10 -05:00
Charles Kerr 257d98545b
refactor: add tr_port_forwarding::Mediator (#3855)
* refactor: add a Mediator class to decouple tr_session and tr_port_forwarding

* refactor: add tr_port_forwarding::Mediator::privatePeerPort()

* refactor: add tr_port_forwarding::Mediator::onPortForwarded()

* chore: avoid unnecessary include of timer.h in other headers

* refactor: use a uniform timerMaker() API in mediators
2022-10-01 09:12:49 -05:00
Harm133 1cd6c0464c
feat: Add IPv6 blocklist support (#3835) 2022-09-30 12:11:52 -05:00
Charles Kerr d82090658f
refactor: remove TR_PRIsv macros (#3842)
* refactor: remove TR_PRIsv from transmission-show

* refactor: remove TR_PRIsv from transmission-edit

* refactor: remove TR_PRIsv from transmission-remote

* refactor: remove TR_PRIsv from log.cc

* refactor: remove TR_PRIsv macro

* chore: remove FMT_STRING macro in transmission-edit

* refactor: use __android_log_write()
2022-09-23 14:36:37 -05:00
L2501 4977c1a02f
add clientIDs for BitTorrent Web, Free Download Manager 6, Torch Browser (#3838) 2022-09-22 16:55:51 -05:00
Charles Kerr 76fc42b659
test: fix watchdir CI flake (#3839) 2022-09-22 15:42:06 -05:00
Charles Kerr 80d9d5a63b
refactor: add tr_peerIo::peek() (#3798) 2022-09-09 13:12:47 -05:00
Charles Kerr c0f29a89ea
refactor: add [[nodiscard]] (#3793) 2022-09-08 21:49:51 -05:00
Charles Kerr 9fb590d3f5
fix: recent coverity warnings (#3788)
* fix: suppress intentional USE_AFTER_FREE in tests

* fix: unnecessary field check

* fix: in ~tr_verify_worker(), release mutex lock before waiting
2022-09-07 19:24:56 -05:00
Charles Kerr 82212ff1d8
refactor: move the verify worker thread into a wrapper class (#3775) 2022-09-05 23:43:59 -05:00
Charles Kerr ae74a13eb1
test: improve file-win32, file-posix test coverage (#3761) 2022-09-04 19:40:34 -05:00
L2501 22669dda5e
Add Advanced Download Manager & LibreTorrent client names (#3750) 2022-09-02 12:37:25 -05:00
Charles Kerr d130f7d593
refactor: prefer std::unique_ptr over std::shared_ptr (#3741) 2022-08-30 19:30:47 -05:00
Charles Kerr b7ea4d9f04
refactor: tr_peerIo ref, unref (#3735)
* refactor: replace manual peerIo refcounting with std::shared_ptr
2022-08-30 12:38:30 -05:00
Charles Kerr 7c014e3256
Refactor/tr peer io member funcs (#3734)
* refactor: make tr_peerIoSetEnabled() a member method

* refactor: make tr_peerIoFlushOutgoingProtocolMsgs() a member method

* refactor: make tr_peerIoFlush() a member method

* refactor: make tr_peerWriteBytes() a member method

* refactor: make tr_peerWriteBuf() a member method

* refactor: make tr_peerIoGetWriteBufferSpace() a member method

* chore: remove unused declaration

* refactor: make tr_peerIoUtpInit() a member method

* refactor: make tr_peerIoNew() a member method

* refactor: make tr_peerIoNewOutgoing() a member method

* refactor: make tr_peerIoNewIncoming() a member method
2022-08-29 15:58:18 -05:00
Charles Kerr cee339e10d
refactor: remove tr_removeElementFromArray() (#3731) 2022-08-28 21:51:26 -05:00
Charles Kerr 072bb0322c
refactor: remove tr_quark_get_string() (#3728) 2022-08-28 16:17:07 -05:00
Charles Kerr 4f3f0ccbeb
refactor: remove unused function tr_sys_file_seek() (#3727)
* refactor: remove TR_SYS_FILE_CREATE_NEW

* refactor: remove tr_sys_file_seek()
2022-08-28 14:10:00 -05:00
Charles Kerr 6c5fda2021
refactor: use std::ifstream in torrent-magnet (#3726) 2022-08-28 12:33:58 -05:00
Charles Kerr 185f1f96a5
test: add torrent-magnet tests (#3725) 2022-08-27 17:06:20 -05:00
Charles Kerr db3467b553
refactor: remove tr_sys file_map_for_reading() (#3723) 2022-08-27 14:05:21 -05:00
Greg Hazel fa8b6a5e0a
option to disable TCP (#3447) 2022-08-25 21:27:11 -05:00
Charles Kerr e8686095ed
refactor: local peer discovery (#3696) 2022-08-24 16:03:30 -05:00
Charles Kerr bbb1ba6ea3
refactor: tr_urlPercentEncode() (#3688) 2022-08-21 08:43:09 -05:00
Charles Kerr dde626d5e5
refactor: remove unused (#3675)
* refactor: remove unused define TR_PATH_DELIMITER_STR

* refactor: make TR_DEFAULT_BIND_ADDRESS_IPV4 private

* refactor: make TR_DEFAULT_BIND_ADDRESS_IPV6 private

* refactor: make TR_DEFAULT_RPC_HOST_WHITELIST private

* refactor: remove unused function tr_sessionSetRPCUrl()

* refactor: remove unused function tr_sessionGetRPCUrl()

* refactor: remove unused field native_local_path_prefix

* refactor: remove unused field native_unc_path_prefix
2022-08-18 22:47:23 -05:00
Charles Kerr c171d6df7c
refactor: remove tr_utf8_validate from public API (#3671)
it was only used as an impl helper, so make it private
2022-08-18 13:23:59 -05:00
Charles Kerr 963a8112a1
refactor: remove tr_strvDup() (#3666) 2022-08-17 21:18:44 -05:00
Charles Kerr bfec98c323
refactor: avoid tr_new() in transmission-remote (#3665) 2022-08-17 20:25:42 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr 6b25a57899
refactor: don't use tr_free in tr_strvUtf8Clean() (#3658) 2022-08-16 21:47:07 -05:00
Charles Kerr e49747ab51
feat: add tr_strvToBuf() (#3657)
* feat: add tr_getDefaultConfigDirToBuf()

* feat: add tr_getDefaultDownloadDirToBuf()

* feat: add tr_strvToBuf()

* feat: add tr_torrentFindFileToBuf()

* feat: add tr_torrentGetMagnetLinkToBuf()

* refactor: remove unused makeString() from tests

* feat: add tr_torrentFilenameToBuf()

* feat: add tr_torrentGetTrackerListToBuf()

* chore: remove obsolete comment references to tr_free

* chore: remove unused tr_strdup()

* chore: remove unused forward declarations
2022-08-16 19:28:57 -05:00
Charles Kerr 988d8ff9ac
test: possibly fix rename-test flakes (#3653)
* test: possibly fix rename-test flakes

* ci: add gettext-dev to alpine workflow

* ci: make utils if tests change, since transmission-show is needed

* ci: add linux-headers to alpine workflow
2022-08-16 17:47:02 -05:00
Charles Kerr 44a291ca39
refactor: remove tr_session nonmember functions (#3641) 2022-08-14 14:41:57 -05:00
Charles Kerr c7466b3ff4
fix: coverity warnings (#3632)
* fix: uninitialized field natpmp

* fix: unchecked downcast result

* fix: potential tr_error leak

* fix: potential tr_error leak

* fix: potential tr_error leak

* fix: potential nullptr dereference in test fixtures

* fix: handshake fields not initialized in constructor

* chore: cast unchecked return value to void

* chore: cast unchecked return value to void

* chore: cast unchecked return value to void

* chore: make single-arg constructors explicit

* fix: code smell make variable a pointer-to-const

* fix: code smell make variable a pointer-to-const

* chore: make single-arg constructors explicit

* chore: silence sonarcloud false warning on commented-out-code

* chore: fix code smell use std::array

* chore: make EvTimer::handleTimer() const

* chore: mark tr_bandwidth remove_child as noexcept
2022-08-13 12:11:07 -05:00
Charles Kerr e781ee1773
refactor: timer pt 3 (#3624) 2022-08-11 14:30:00 -05:00
Charles Kerr c66303fae2
refactor: watchdir (#3606) 2022-08-10 08:34:51 -05:00
Guido Vranken b1cc968969
Fix out-of-bounds read in torrent parsing (#3600)
Fixes #3591
2022-08-09 17:04:56 -05:00
Charles Kerr b49cccbd3e
refactor: add timer class (#3603)
Wraps around evtimer so that some of the codebase can use libevent without coupling to it.
2022-08-08 17:53:20 -05:00
Charles Kerr 83ffa6bf1b
chore: fix spdx abbreviations (#3602) 2022-08-08 13:05:39 -05:00
Charles Kerr 31a733fab7
refactor: make tr_session_id a class (#3598) 2022-08-06 14:27:37 -05:00
Charles Kerr 868fc1ab78
Refactor/tr variant from buf (#3592)
* refactor: use std::string in tr_watchdir_inotify_on_event()

* refactor: add template tr_variantFromBuf() variant

if it has .data() and .size() it is good
2022-08-05 16:12:45 -05:00
Charles Kerr 4bc1589c5d
refactor: remove tr_win32_utf8_to_native_ex() (#3590) 2022-08-05 14:16:25 -05:00
Charles Kerr 8b983b3d1c
refactor: tr_sys_path_resolve() returns a std::string (#3587)
* refactor: tr_sys_path_resolve returns std::string
2022-08-05 11:36:01 -05:00
Charles Kerr 3ed6b187bb
refactor: iwyu utils.h (#3583) 2022-08-04 08:44:18 -05:00
Charles Kerr 4f6909a27a
refactor: tr_sys_dir_get_current() returns a std::string (#3581) 2022-08-03 23:59:41 -05:00
Charles Kerr ef34c7c4dc
refactor: use std::wstring on win32 (#3578) 2022-08-03 18:07:38 -05:00
Charles Kerr bf8f72e61f
refactor: tr_metainfo_builder() (#3565) 2022-08-02 14:46:08 -05:00
Charles Kerr 5eb7f75010
refactor: tr_sys_path_get_info() now returns a tr_sys_path_info (#3566)
* refactor: tr_sys_path_get_info() now returns a tr_sys_path_info

* refactor: tr_sys_file_get_info() now returns a tr_sys_path_info
2022-08-02 12:41:04 -05:00
Charles Kerr 18e2a04f88
refactor: make sha1, sha256 RAII safe (#3556) 2022-07-31 15:58:14 -05:00
Charles Kerr e0ca366b2d
refactor: remove tr_loadFile() (#3540)
* refactor: use the std::vector variant of tr_loadFile() in rpc-server.cc

* refactor: use the std::vector variant of tr_loadFile() in rename-test.cc

* refactor: remove the unused raw ptr variant of tr_loadFile()
2022-07-28 14:22:32 -05:00
Charles Kerr 15056045bd
perf: batch up calls to the RNG (#3537) 2022-07-28 10:01:59 -05:00
Charles Kerr ec79a2a888
fix: clang-tidy misc-const-correctness warnings (#3529) 2022-07-27 09:03:13 -05:00
Charles Kerr 0e7ef51d5c
refactor: tr_env_get_string() now returns a std::string (#3527) 2022-07-26 23:26:37 -05:00
Charles Kerr 1a0afbe95e
refactor: iwyu (#3525) 2022-07-25 21:45:54 -05:00
Charles Kerr d09aba0e6a
refactor: remove tr_address_from_string() (#3524)
use tr_address::fromString() instead

* refactor: use tr_address.isIPv4()
2022-07-25 17:25:55 -05:00
Mike Gelfand 4a18c503c7
Don't call `front()` on an empty string (#3520) 2022-07-25 00:01:42 +01:00
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