Commit Graph

66 Commits

Author SHA1 Message Date
Dmitry Antipov acbf483bae
refactor: switch to C++11-compatible tr_wait() from tr_wait_msec() (#4576) 2023-01-12 12:03:14 -06:00
Charles Kerr 106bcbbe7b
fix: clang-tidy-15 warnings (#4525) 2023-01-03 14:10:12 -06:00
Charles Kerr 806491232b
refactor: add constexpr (#4514) 2023-01-01 22:43:23 -06:00
Charles Kerr 14a3d01e45
fix: sonarcloud (#4453) 2022-12-23 10:56:27 -06:00
Charles Kerr a1892f2c7c
fix: 4.0.0-beta.2 regression transmission-show --scrape did not exit cleanly (#4447) 2022-12-23 08:03:26 -06:00
Charles Kerr f03fc9270b
Fix/long shutdown crash on shutdown (#4285) 2022-11-30 13:00:34 -06:00
Charles Kerr 22d12aedc5
refactor: GTK favicon lookup improvements (#4278) 2022-11-29 18:09:32 -06:00
Charles Kerr 67e992ddf0
refactor: better TR_CURL_SSL_NO_VERIFY (#4159)
clear CURLOPT_CAINFO, CURLOPT_CAPATH iff verification is disabled
2022-11-13 17:17:16 -06:00
Charles Kerr 7e817b5a43
refactor: fix thread sanitizer warnings in tr_sessionClose() (#4130) 2022-11-09 20:30:34 -06:00
Charles Kerr 4d8509c180
refactor: add libtransmission::evhelpers (#4104) 2022-11-06 15:11:30 -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 d130f7d593
refactor: prefer std::unique_ptr over std::shared_ptr (#3741) 2022-08-30 19:30:47 -05:00
Viacheslav Chimishuk cb17ea4914
Fix IPv6 announce socket binding interface. (#3692)
When Transmission listens on both IPv4 and IPv6 interfaces IPv4 listen address
is always passed to CURL's CURLOPT_INTERFACE. In general it stays unnoticed but
if user has multiple IPv6 addresses configured on his system random (first?)
IPv6 address is used. It happens because passed value to CURLOPT_INTERFACE
is not correct -- IPv6 expected but IPv4 is passed.
2022-08-21 18:37:38 -05:00
Charles Kerr 4b615572c3 chore: re-enable readability-redundant-access-specifiers warning (#3685) 2022-08-20 14:49:11 -05:00
Charles Kerr c532728c42
refactor: remove TR_N_ELEMENTS macro (#3674)
* refactor: use std::array for keys in transmission-remote

* refactor: use std::array for wide_module_path in platform.cc

* refactor: use std::array for value in tr_env_get_int()

* refactor: use std::array for SysStoreNames in web.cc

* chore: remove unused macro TR_N_ELEMENTS
2022-08-18 21:31:53 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr 3428076ecd
fix: cppcoreguidelines-special-member-functions warnings in libtransmission (#3575) 2022-08-03 12:03:28 -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
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 adc105ed2c
fix: deadlock between session and web mutexes (#3251)
Fixes #3242.

Introduced by #2693.
2022-06-10 23:56:43 -05:00
Charles Kerr 80dd460773
refactor: annotate nodiscard, constexpr, noexcept methods (#2879) 2022-04-04 22:51:56 -05:00
Charles Kerr 6db3fbfe64
perf: tell curl_share to share everything (#2802) 2022-03-23 22:02:18 -05:00
Charles Kerr fa8aaf7631
refactor: remove remaining vararg log messages (#2776) 2022-03-17 17:39:06 -05:00
Charles Kerr 72a67054ea
refactor: fmt part 2 (#2771) 2022-03-15 09:52:16 -05:00
Charles Kerr af339a15ed
refactor: remove deep logging (#2749)
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr 412ebc63c6
fixup: webseed (#2712)
* fixup! refactor: tr_webseed simplification (#2613)

call connection_limiter.taskStarted in the right place

* perf: put web thread to sleep when inactive
2022-02-25 14:45:00 -06:00
Charles Kerr a0c25b21af
fixup! refactor: tr_web (#2633) (#2693)
race condition in TR_ASSERT
2022-02-23 11:00:40 -06:00
Charles Kerr 7238724318
refactor: webseed (#2689)
* refactor: reduce nested conditional webseed logic

* refactor: use tr_block_info::Location in webseed

* request larger chunks at a time from webseeds

* fix: CURLOPT_MAXREDIRS to safeguard against loops

Discussion at https://trac.transmissionbt.com/ticket/6110 .
Reported by @x190 and @cfpp2p a few years back.
2022-02-23 07:38:18 -06:00
Charles Kerr 95e30768c4
refactor: rename mediator classes (#2681) 2022-02-22 09:09:24 -06:00
Charles Kerr 29af76d977
refactor: tr_web (#2640)
* fixup! refactor: tr_web (#2633)

fix: race condition in web threadfunc during bootstrap

fixes #2639
2022-02-17 17:35:57 -06:00
Charles Kerr f1a53840f9
refactor: tr_web (#2633)
* refactor: fix tr_web rate limiting and dns caching
2022-02-16 12:33:50 -06:00
Charles Kerr 8805d7c67b
refactor: remove tr_webGetTaskResponseCode() (#2628)
It's not really needed anymore, and removing it is aligned with the
goal of simplifying the tr_web and tr_webseed codebase.
2022-02-14 16:39:52 -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 94c7208d82
feat: use new envvar TR_CURL_PROXY_SSL_NO_VERIFY (#2622)
Co-authored-by: Andrey Pavlenko <andrey.a.pavlenko@gmail.com>
2022-02-13 22:24:15 -06:00
Charles Kerr a822a46e47
refactor: add fetch options object to tr_webRun() (#2620)
* refactor: add fetch options object to tr_webRun()

Fold `tr_webRun()`, `tr_webRunWithCookies()`, and `tr_webRunWebseed()`
into a single API that takes an options argument that callers can
customize to their needs.

Also does a surface cleanup pass to the tr_webseed and tr_web internal
structures, e.g. making fields const where possible, not using raw
pointers, and making some fields private.

This revision is still full of code smells. Refactoring the entire
system is overwhelming, so instead I'm doing it in incremental steps.
2022-02-13 20:09:56 -06:00
Charles Kerr dfe79af34c
refactor: tr_webseed simplification (#2613)
* refactor: remove effective-url caching in webseeds

The upcoming CURLSH refactor is a more effective way of doing this and
the current appoach makes tr_web harder to refactor, so remove it.

* refactor: webseed rate limiting

The current code that limits the number of parallel fetches is overly
complicated and is also interwoven into the tr_webseed class. Extract
it into a new private helper class "ConnectionLimiter" with a simpler
public API for tr_webseed to use.
2022-02-12 16:52:40 -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 ecef0feb0c
refactor: clang-tidy in libtransmission (#2578)
* chore: enable cppcoreguidelines-slicing warning

* chore: enable readability-named-parameter warning

* chore: enable bugprone-reserved-identifier check

* chore: enable bugprone-not-null-terminated-result check

* chore: enable bugprone-sizeof-expression check

* chore: enable bugprone-incorrect-roundings check

* chore: enable misc-misplaced-const check

* chore: enable bugprone-suspicious-include check

* chore: enable bugprone-signed-char-misuse check

* chore: enable modernize-raw-string-literal check

* chore: enable readability-static-accessed-through-instance check

* chore: enable readability-implicit-bool-conversion check

* fixup! Merge branch 'main' into refactor/clang-tidy
2022-02-06 22:28:36 -06:00
Charles Kerr 878405f862
Revert "fix: sonarcloud (#2558)" (#2562)
This reverts commit 8b9483f7fb.
2022-02-01 11:30:51 -06:00
Charles Kerr 8b9483f7fb
fix: sonarcloud (#2558)
* fix: add const modifier for functions

* fix: many sonarcloud use-init-statement warnings
2022-01-31 22:46:27 -06:00
Charles Kerr 87dfabb9d2
refactor: replace tr_thread with std::thread (#2548) 2022-01-31 13:34:04 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr b0ee4007ff
refactor: include cleanups (#2392)
* refactor: include <memory> when using shared_ptr or unique_ptr

* refactor: include <cstdio> iff we use it

* refactor: include <cstring> iff we use it

* refactor: include <cstdlib> iff we use it

* refactor: include <string_view> or <string> iff we use it

* refactor: include <array> iff we use it

* refactor: include <ctime> iff we use it

* refactor: include <cctype> iff we use it

* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr a5c6168805
refactor: make tr_buildPath() private (#2374) 2022-01-02 11:51:59 -06:00
Charles Kerr 37a8046ed5
fix: more sonarcloud warnings (#2324) 2021-12-16 23:47:51 -06:00
Charles Kerr e4a172d39c
fix: sonarcloud (#2322)
* fix: sonarcloud warning - redundant cast

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - move #include to top of file

* fix: sonarcloud warning - implicit conversion loses precision

* fix: sonarcloud warning - confirm safe use of strlen

* fix: sonarcloud warning - refactor code to not nest more than three deep

* iwyu: cstring

* iwyu: algorithm
2021-12-16 16:58:58 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -06:00
Charles Kerr dc36787378
fix: coverity warnings (#2229)
* fix: coverity uninitialized member warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371746\&defectInstanceId\=52288281\&mergedDefectId\=1494442\&eventId\=52288281-41

* fix: coverity uninitialized member warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371746\&defectInstanceId\=52288281\&mergedDefectId\=1494442\&eventId\=52288281-43

* fix: coverity unchecked return value

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371760\&defectInstanceId\=52254984\&mergedDefectId\=1494150

* fix: coverity false nullptr dereference warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204369613\&defectInstanceId\=52254971\&mergedDefectId\=1493396

* fix: coverity unchecked return value

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204369625\&defectInstanceId\=52288288\&mergedDefectId\=1491891
2021-11-25 18:14:25 -06:00
Charles Kerr da855a7257
refactor: use std mutex/lock intead of bespoke (#2194)
* refactor: use std mutex/lock intead of bespoke
2021-11-20 15:20:45 -06:00