Commit Graph

46 Commits

Author SHA1 Message Date
Charles Kerr af339a15ed
refactor: remove deep logging (#2749)
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr cdd819772d
feat: tr_runInEventThread() now takes std::function, typesafe args (#2739) 2022-03-04 20:26:03 -08:00
Charles Kerr 9c3acc7e8a
fixup: handle unhandled scrape/announce responses (#2701)
followup to the #2531 benc refactor
2022-02-24 07:59:58 -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 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 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 e908193027
fix: some use-init-statement sonarcloud warnings (#2563) 2022-02-01 19:09:11 -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 314aa6925d
fix: sonarcloud use-init-statement warnings in new code (#2536) 2022-01-29 16:26:09 -06:00
Charles Kerr 9e264250d1
refactor: add benc::Handler::Context (#2531)
Prerequisite for using the new benc parser in tr_torrent_metainfo:
That code needs to know the span of the bencoded info dict.
2022-01-28 16:46:14 -06:00
Charles Kerr 7f60738cce
refactor: use the new benc parser in announcer-http (#2529) 2022-01-28 12:39:45 -06:00
Charles Kerr 3c5442dd7b
test: add tests for parsing http tracker scrape responses (#2527) 2022-01-27 17:18:50 -06:00
Charles Kerr 064ad6a436
refactor: saxlike benc pt. 2: add announce response parsing tests (#2505) 2022-01-24 22:25:55 -06:00
Charles Kerr 26bb9f3440
fix: sonarcloud code smells (#2486) 2022-01-23 18:53:35 -06:00
Charles Kerr b45c831bcb
refactor: use C++ objects in announcer (#2474) 2022-01-22 23:41:01 -06:00
vuori a89b98f9e5
Fixed wrong ipv6 addr used in announces. (#265) 2022-01-20 15:28:04 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr 3036a76beb
fix: sonarcloud code smells (#2421) 2022-01-17 12:39:50 -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 88f9704eed
refactor: remove varargs code in tr_sys_file (#2354) 2021-12-28 09:08:04 -06:00
Charles Kerr fa35b8ad39
refactor: use std::string in tr_variantToStr() (#2351)
* refactor: use std::string in tr_variantToStr()
2021-12-27 16:47:25 -06:00
Charles Kerr dd1379b0b6
refactor: add tr_interned_string (#2332) 2021-12-23 11:16:05 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -06:00
Charles Kerr 74f367c150
fix: sonarcloud (#2227)
* fix: sonarcloud useless-sequence-of-pointer-operators warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzyMRYbK9dvryvWm8XC\&open\=AXzyMRYbK9dvryvWm8XC

* fix: sonarcloud unused-function warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTE\&open\=AX06Stxd1usi2gyYkPTE

* fix: sonarcloud init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzyMRABK9dvryvWm8Wv\&open\=AXzyMRABK9dvryvWm8Wv

* fix: sonarcloud assignment-in-expression warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXztC8rqIH_lVCrUGWcX\&open\=AXztC8rqIH_lVCrUGWcX

* fix: sonarcloud use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXy-sssdW63O2GMuTBKY\&open\=AXy-sssdW63O2GMuTBKY

* fix: replace-redundant-type-with-auto warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXy-sssdW63O2GMuTBKZ\&open\=AXy-sssdW63O2GMuTBKZ

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzOK_MX7S1ht0f4sjIh\&open\=AXzOK_MX7S1ht0f4sjIh

* fix: use-structured-binding-declaration warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTK\&open\=AX06Stxd1usi2gyYkPTK

* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTL\&open\=AX06Stxd1usi2gyYkPTL

* fix: use-structured-binding-declaration warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTP\&open\=AX06Stxd1usi2gyYkPTP

* fixup! fix: use-structured-binding-declaration warning

* Revert "fix: sonarcloud useless-sequence-of-pointer-operators warning"

This reverts commit 26c99e75c6.

cannot convert from 'const _InIt' to 'const rpc_method *'
2021-11-25 16:39:19 -06:00
Charles Kerr a79a868257
refactor: make tr_variantFromBuf() public (#2187)
* refactor: add tr_variantFromBuf() and support inplace json/benc parsing
2021-11-17 23:37:35 -06:00
Charles Kerr da142f400e
refactor: tr_address_from_string is now std::string_view-friendly (#2176) 2021-11-15 17:03:55 -06:00
Charles Kerr cef3f43088
refactor: tr_web's callback now uses std::string_view (#2172)
* refactor: tr_web tasks now use a std::string_view argument
2021-11-15 12:10:18 -06:00
Charles Kerr 250a2e3cc5
refactor: remove unused pieces of str to variant (#2166)
* feat: add tr_variantInitStrView()

* refactor: remove unused function tr_variantFromJsonFull

* refactor: tr_variantFromJson() now takes a string_view

* refactor: tr_variantFromBenc() now takes a string_view

* refactor: remove unused source arg from tr_variantFromBencFull()

* refactor: make tr_variantFromBuf() private
2021-11-15 01:21:57 -06:00
Charles Kerr bdf1bb6d17
refactor: tr_strv*() util functions (#2123)
* feat: add tr_strv utils
2021-11-09 18:13:47 -06:00
Charles Kerr d8b57fe4dc
refactor: web_utils (#2121)
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00
Charles Kerr be22677f10
refactor: prefer string_view over raw char* (#2097) 2021-11-05 01:29:19 -05:00
Charles Kerr 7724111a8b
refactor: increase use of tr sha1 digest t (#2091)
* refactor: make tr_sha1_digest_t an array of std::byte

* refactor: increase use of tr_sha1_digest_t
2021-11-03 19:55:04 -05:00
Charles Kerr 9dca5f2086
perf: intern the announcer module's URL strings (#2085)
* perf: intern the announcer module's internal URLs
2021-11-02 18:00:01 -05:00
Charles Kerr 790b0bb2b5
feat: add tr_quark_get_string_view() (#2083) 2021-11-01 20:01:27 -05:00
Charles Kerr 3a4dd6de95
refactor: add TR_PRIsv and TR_PRIsv_ARG (#2080)
* refactor: add TR_PRIsv, TR_PRIsv_ARG macros

Like PRId64 and similar macros, these new macros are printf() helpers.
They are for passing std::string_views to printf()-like functions.
2021-11-01 17:14:17 -05:00
Charles Kerr b9e8a11793
fixup! refactor: use std::string in tr_scrape_response (#1866) (#2018)
fix leaked errmsg introduced in 3fd5c81 (#1866)
2021-10-22 18:14:46 -05:00
Charles Kerr b491da0ce4
refactor: add tr_peer_id_t (#2004)
* refactor: move handshake_done args into a convenience struct

* refactor: move peer_id from peerIo to tr_handshake

tr_handshake is a short-term object and tr_peerIo is long-term, so this
effectively narrows the scope of this field.

* chore: remove unused field tr_peerIo.isEncrypted

* refactor: add tr_peer_id_t type to hold peer ids.

this is a 'using' alias to a std::array<> so that code passing peer-ids
around doesn't have to memcmp / memcpy PEER_ID_LEN anymore. Also removes
the now-unused PEER_ID_LEN macro.
2021-10-21 21:40:55 -05:00
Charles Kerr 16e9a99fe9
refactor: clang-tidy --fix modernize-deprecated-headers (#1980) 2021-10-17 15:17:18 -05:00
Charles Kerr 43ad1346eb
refactor: tr_torrentInfoGetMagnetLink now takes a std::string_view (#1968)
* refactor: tr_torrentInfoGetMagnetLink now takes a std::string_view
2021-10-16 08:20:04 -05:00
Charles Kerr 5df6e4f88f
fix: uninitialized variables in announcer (#1936) 2021-10-14 09:22:28 -05:00
Charles Kerr 3fd5c81a22
refactor: use std::string in tr_scrape_response (#1866) 2021-09-30 16:33:31 -05:00
Dmytro Lytovchenko 43d1ece562
C++ modernization: Replace NULLs with typesafe nullptrs (#1799)
Fixing CI errors and build errors
Reverted changes: NULL in EV_SET macro; Clang-formatting
Reverted changes: MacosX *.m files reverted from master
2021-09-14 19:18:09 -05:00
Charles Kerr 4c1b627647
refactor: port libtransmission to C++ (#1787)
Port libtransmission to C++. This PR doesn't refactor everything to c++.
Its code changes are only what was necessary to compile and link as c++.
See libtransmission/README.md for details on how to submit modernization 
patches!

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-12 12:41:49 -05:00
Renamed from libtransmission/announcer-http.c (Browse further)