Commit Graph

660 Commits

Author SHA1 Message Date
Dmitry Antipov 161330ae16
refactor: add more C++ glue for the daemon (#3815)
Get rid of C-style callbacks on void pointers and convert (well, the
most of) daemon code to (somewhat more) real C++, adjust related bits.
2022-09-12 23:37:12 -07:00
Dmitry Antipov 828d008f82
daemon: use evsignal-based signal handling on POSIX systems (#3782)
If signalfd(2) interface is not available (i.e. everywhere
except Linux), use evsignal interface to manage signals.
2022-09-08 04:23:54 -05:00
Dmitry Antipov 050ee1cbbd
daemon: use signalfd-based signal handling if available (#3778)
If signalfd(2) interface is available, prefer it over traditional signal
handlers. This is mostly intended to drop dedicated signal handling thread
and hook signal processing into libevent event loop in the most natural way.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
2022-09-07 15:12:35 -05:00
Dmitry Antipov 44c5d3edbd
refactor: fold common daemon code into C++ class (#3767)
Fold common daemon code into Daemon class, adjust related bits.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
2022-09-05 16:28:15 -05:00
Charles Kerr 76a7994eef
refactor: remove tr_free() (#3668) 2022-08-18 09:14:12 -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 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 7c5862a5f5
refactor: remove tr_new, tr_free pt. 1 (#3626)
* refactor: tr_torrentGetMetadataPiece() returns an optional vector

* refactor: use tr_pathbuf in create_temp_path()

* refactor: use tr_pathbuf in win32 create_temp_path()

* refactor: use std::vector in isPeerInteresting()

* refactor: remove tr_new0 from tr_peerMgrPeerStats()

* refactor: remove tr_new0 from rechokeUploads()

* refactor: silence clang nullptr dereference warning

* refactor: make tr_natpmp a C++ class

* refactor: use std::string in tr_log_message
2022-08-11 19:59:58 -05:00
Charles Kerr c66303fae2
refactor: watchdir (#3606) 2022-08-10 08:34:51 -05:00
Charles Kerr 83ffa6bf1b
chore: fix spdx abbreviations (#3602) 2022-08-08 13:05:39 -05:00
Charles Kerr ef34c7c4dc
refactor: use std::wstring on win32 (#3578) 2022-08-03 18:07:38 -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
Robin Seth Ekman 9eeb3db89c
daemon: deprecated --log-error -> --log-level=error (#3201) 2022-06-05 01:13:11 -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
Antoine Cœur d3e1c83c9b
Address build warnings (#3052) 2022-05-04 18:54:41 -05:00
Antoine Cœur c708b83a3f
update documentation links (#2985) 2022-04-25 18:18:35 -05:00
Antoine Cœur bdac708762
docs: fix various typos and misspellings (#2955) 2022-04-21 09:28:38 -05:00
Charles Kerr 5b6f0a52fd
fixup: minor log string formatting changes (#2913)
* fixup! fix: sonarcloud (#2865)

fix: log time format string

* fix: formatting changes

* fixup! refactor: remove tr_strvJoin() (#2896)

fix: daemon logging

Co-authored-by: Catadropa <catadropa@users.noreply.github.com>
2022-04-13 23:19:18 -05:00
Charles Kerr 205abbbcce
refactor: iwyu string, vector, cstdint (#2898)
* refactor: use cstdint for intX_t types

* refactor: iwyu sstring_view

* refactor: iwyu <cstring>

* refactor: iwyu <vector>
2022-04-07 20:50:26 -05:00
Charles Kerr 31c65eec1f
refactor: remove tr_strvJoin() (#2896) 2022-04-07 17:26:59 -05:00
maxz 738431169c
Fix typographical errors in the man pages. (#2875) 2022-04-04 13:37:35 -05:00
Pierre Carru 32cff69213
torrent-daemon: watchdir can use .magnet files (#1328) 2022-04-03 21:14:44 -05:00
Charles Kerr 392e511f7e
refactor: remove tr_snprintf() pt 1 (#2867)
* refactor use fmt instead of tr_snprintf in remote.cc

* refactor use fmt instead of tr_snprintf in daemon.cc

* refactor use fmt instead of tr_snprintf in cli.cc
2022-04-02 14:34:29 -05:00
Charles Kerr e64430941f
refactor: remove tr_strdup_printf() (#2854) 2022-03-31 19:13:37 -05:00
Charles Kerr 71ad42b1ef
refactor: make err arg optional in tr_sys_* funcs (#2827) 2022-03-27 12:37:29 -05:00
Charles Kerr 6e8f9f3ff0
feat: add tr_strbuf (#2810)
* feat: add tr_strbuf class for building tmp strings

Based on fmt::basic_memory_buf, this is a growable string buffer that
has an initial size that's large enough to build most filenames or URLs
without needing heap allocations.

Adds a couple of extra helpers such as a `c_str()` method to make dealing
with old zero-terminated string APIs easier.
2022-03-24 16:41:29 -05:00
Charles Kerr fcc1510ecb
refactor: use fmt to build the GTK client's user-visible strings (#2788)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-21 09:15:48 -05:00
Charles Kerr 7b837bca1f
fixup! refactor: remove deep logging (#2749) (#2785)
handle new log levels in daemon cli invocation
2022-03-18 14:15:43 -05:00
Charles Kerr 68646df4e3
docs: add pid-file to transmission-daemon manpage (#2784)
Fixes #2766.

Co-authored-by: Tim Tassonis <stuff@decentral.ch>
2022-03-18 12:59:45 -05:00
Charles Kerr fa8aaf7631
refactor: remove remaining vararg log messages (#2776) 2022-03-17 17:39:06 -05:00
Charles Kerr 54ef7341a2
refactor: fmt pt 4 (#2774)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-16 19:23:44 -05:00
Charles Kerr 0be920156b
refactor: fmt part 3 (#2773) 2022-03-15 19:51:36 -05:00
Charles Kerr a942c67199
refactor: use fmt (#2758)
* deps: use fmt (8.1.1 tag) to build log strings

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-13 23:43:35 -05:00
Charles Kerr d2f8e1d4e0
refactor: set logging levels (#2755) 2022-03-11 15:09:22 -06:00
Charles Kerr af339a15ed
refactor: remove deep logging (#2749)
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
FallenWarrior2k e7272fc340
fix(daemon): wait for network-online.target (#2721)
network.target does not guarantee interfaces are fully configured, which
can result in bound addresses not being available when the daemon
starts. This leads to errors on start-up and potentially broken
connectivity.
network-online.target does provide these guarantees, but needs a
slightly different dependency configuration with Wants= on top of After=
(cf. systemd.special(7)).

Closes #2720.
2022-02-28 19:25:07 -08:00
Stefan Talpalaru 7b377511a9 feat: default public trackers 2022-02-21 08:34:57 -06:00
Jelle van der Waa 18b8e98e3f
Add ProtectSystem and PrivateTmp to systemd service (#1452)
ProtectSystem mounts /boot, /efi and /usr as read only, basically
disallowing the daemon from ever writing there. PrivateTmp sets up a
file system namespace for /tmp and /var/tmp/ basically hiding it from
other processes.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-02-13 14:06:55 -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
Craig Andrews 56dab2bd18
daemon: deny memory wx in transmission-daemon.service (#2573)
Attempts to create memory mappings that are writable and executable at the same time, or to change existing memory mappings to become executable, or mapping shared memory segments as executable are prohibited.

There's no reason transmission should be doing that. If it does, it's because of malicious code exploiting a vulnerability.

See: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#MemoryDenyWriteExecute=
2022-02-04 22:08:51 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr 884135d853
fix: sonarcloud (#2356)
* refactor: replace #define with constexpr in some utils

* fix: use-std-string-instead-of-c-array sonarcloud warning

* fix: use init-statement sonarcloud warning

* fix: explain-empty-function sonarcloud warning

* fix: move #include directive to top sonarcloud warning

* fix: replace-void-ptr-arg-with-more-meaningful-type sonarcloud warning

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

* fix: use-init-statement sonarcloud warning

* fix: make type a pointer-to-const sonarcloud warning

* fix: cli tyop

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

* fix: use-init-statement sonarcloud warning

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

* fix: use-init-statement sonarcloud warning

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

* fix: make type a pointer-to-const sonarcloud warning

* fix: make type a pointer-to-const sonarcloud warning

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

* refactor: replace #define with constexpr in rpcimpl
2021-12-28 11:23:47 -06:00
Charles Kerr 88f9704eed
refactor: remove varargs code in tr_sys_file (#2354) 2021-12-28 09:08:04 -06:00
Charles Kerr 02aa2f46d4
refactor: don't use varargs in tr_error (#2352) 2021-12-27 20:32:22 -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 a515c1d94b
refactor: use tr_torrent_metainfo in tr ctor (#2345) 2021-12-26 10:25:07 -06:00
Charles Kerr b058daff4b
refactor: change tr_torrentNew() args (#2337) 2021-12-24 16:05:17 -06:00
Charles Kerr 7ca0b4cc25
fix: sonarcloud (#2327) 2021-12-17 14:48:02 -06:00