Commit Graph

5196 Commits

Author SHA1 Message Date
SweetPPro bfd7797c5e
fix: magnet link metainfo corrupted on restart (#2790) 2022-04-01 15:28:55 -05:00
Charles Kerr 1f15933fda
fix: incorrect magnet size calcuation in tr_completion (#2856) 2022-04-01 08:49:54 -05:00
Charles Kerr e64430941f
refactor: remove tr_strdup_printf() (#2854) 2022-03-31 19:13:37 -05:00
Charles Kerr 98e8d5a3da
fix: getBandwidthGroup use right group (#2853)
Fixes #2828.
2022-03-31 15:07:01 -05:00
Matan Ziv-Av 946cf04833
Bandwidth group are written to a dict, not to a list. (#2852)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-03-31 13:35:21 -05:00
Charles Kerr 6e91136b53
fix: three asan issues (#2851)
* fixup! feat: add support for adding torrents by raw hash values (#2608)

fix array-bounds-read issue found by asan

* fixup! refactor: tr_completion (#2220)

fix array-bounds-read issue in tests fixtures

* fixup! refactor: tr_torrents (#2722)

fix memory leak in torrent-tests
2022-03-31 12:12:54 -05:00
Charles Kerr e4461c48d7
refactor: prefer FMT_STRING (#2845)
* use FMT_STRING in libtr client on non-i18n strings

This gives compile-time safety checks.
2022-03-30 14:59:13 -05:00
Charles Kerr f4afb76695
perf: replace tr_torrentFindFile2() with tr_torrrent.findFile() (#2839) 2022-03-30 13:25:41 -05:00
Charles Kerr 4dd25d8112
fix: tr_strbuf move op loses zero-termination (#2843) 2022-03-30 12:10:51 -05:00
Charles Kerr 66638cc80c
test: fix race condition in move-test (#2841) 2022-03-30 01:30:39 -05:00
Charles Kerr f1a028bb84 chore: revert 2f677aebb assertion 2022-03-29 10:27:34 -05:00
Charles Kerr 4177e286a1
fix: sonarcloud (#2837)
* fix: rename variable to avoid shadow warning w/UTP

* fix: add default dtor for tr_strbuf

* fix: implicit conversion may lose precision

* fix: use init-statement to reduce variable scope

* fix: implicit conversion may lose precision

* fix: extract the assignment from this expression

* fix: use init-statement to reduce variable scope

* fix: use init-statement to reduce variable scope

* fix: do not mix public and private data members

* fix: add a condition to cv.wait call

* fix: do not throw uncaught exceptions in destructor
2022-03-29 05:57:04 -05:00
Charles Kerr 2f677aebb0
refactor: add tracer assertionf or bug #2727 (#2836) 2022-03-28 23:29:35 -05:00
Charles Kerr 2996e223dd
refactor: strbuf for metainfo files (#2833)
* refactor: tr_ctorSaveContents takes a string_view filename

* refactor: remove tr_ctorSaveMagnetContents

* refactor: announce_list::save takes a std::string_view

* refactor: magnet() takes an OutputIt arg

Generate the magnet link URL into an output iterator

* refactor: remove deprecated calls to tr_http_escape

* refactor: tr_torrent.torrentFile takes an OutputIterator

* refactor: tr_torrent.torrentFile returns a tr_pathbuf

* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf

* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -05:00
Charles Kerr 9d141ee2b1
refactor: add fmt::formatters (#2829)
* refactor: add fmt::formatters
2022-03-27 21:55:30 -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 4c2cb23c24
refactor: tr_variantToFile() takes a string_view filename (#2824)
* chore: fix shadowed variable warning

"byte" is declared by a third-party UTP header

* refactor: tr_variantFromFile, tr_variantToFile take a string_view filename
2022-03-25 22:39:08 -05:00
Charles Kerr 977b2a1bab
refactor: tr_loadFile() tr_saveFile() take a std::string_view filename arg (#2822)
* refactor: tr_saveFile takes a string_view

* refactor: tr_saveFile, tr_loadFile take string_view filename
2022-03-25 19:31:27 -05:00
Charles Kerr 1051160b99
feat: strbuf features (#2821)
* feat: strbuf is always zero-terminated

* feat: tr_strbuf::append() now takes any number of args

* feat: tr_strbuf handles zero-terminated string inputs

* feat: add tr_strbuf::ends_with()

* feat: add tr_strbuf::starts_with()

* refactor: replace buildPath() with join()
2022-03-25 16:16:26 -05:00
Charles Kerr 9451446e6d
fix: set the destructor log level to trace (#2820)
Fixes #2816.
2022-03-25 14:14:27 -05:00
Charles Kerr b94c6796c8
fix: sonarcloud warnings (#2815)
* fix: add default case to switch statement

* fix: remove redundant static specifier

* fix: use std::optional.value_or

* fix: make type of variable pointer-to-const

* refactor: move log state into a struct

* refactor: make tr_peerMgr constructor explicit

* fix: make type of variable pointer-to-const

* fix: replace insert with try_emplace

* fix: implicit conversion may lose precision

* fix: use init-statement to reduce variable scope

* chore: mark unused return value with (void)
2022-03-25 00:24:04 -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 783fa500e7
fix: set the utp state change log level to trace (#2809)
Fixes #2808.
2022-03-24 13:46:34 -05:00
Charles Kerr f19c09ad9b
fix: bugprone-narrowing-conversions warnings in bitfield.cc (#2806) 2022-03-24 08:31:00 -05:00
Charles Kerr b8c3778cf4
fix: sonarcloud warnings (#2804)
* fix: break will never be executed

* refactor: compile the name fallback string

* fix: replace redundant type with auto

* fix: use init-statement to reduce variable scope

* fix: implicit conversion loses precision

* fix: use in-class initializer

* fix: make variable a pointer-to-const

* fix: local variable name shadows class variable

* fix: implicit conversion may lose precision
2022-03-24 00:18:41 -05:00
Charles Kerr 6db3fbfe64
perf: tell curl_share to share everything (#2802) 2022-03-23 22:02:18 -05:00
SweetPPro 791f59e8ba
fix for editing magnet link tracker list (#2793)
Co-authored-by: SweetPPro <sweetppro@users.noreply.github.com>
2022-03-23 10:18:06 -05:00
David Beinder 53dc3a41b4
fix: return correct bitfield when fully downloaded (#2799)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-03-22 14:01:07 -05:00
Charles Kerr 04a4f4a10c
refactor: a little more logging (#2800)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-22 11:45:56 -05:00
SweetPPro 6e1b89d9a7
fixes "no data found..." error on restart for paused torrents (#2797)
Co-authored-by: SweetPPro <sweetppro@users.noreply.github.com>
2022-03-21 16:15:53 -05:00
Charles Kerr 03ee0028d4
refactor: tr_sys_path_dirname returns a std::string (#2792) 2022-03-21 15:22:50 -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 44e30bf092
perf: avoid excess filesystem checks (#2786) 2022-03-18 16:31:25 -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 22499c677a
refactor: aggregate bandwidth objects (#2783) 2022-03-18 11:34:29 -05:00
Matan Ziv-Av c07bac4e19
Limit bandwidth used by a group of torrents (#2761)
* Add support for bandwidth groups. i.e. Bandwidth limit for a (user specified) group of torrents,
2022-03-18 08:11:59 -05:00
Charles Kerr 6cb0498486
fix: log unexpected announce/scrape keys (#2778)
Fixes #2765.
2022-03-17 19:31:24 -05:00
Charles Kerr fa8aaf7631
refactor: remove remaining vararg log messages (#2776) 2022-03-17 17:39:06 -05:00
Charles Kerr 5df252d1e1
fix: calculate ratio as uploaded / sizeWhenDone (#2770) 2022-03-17 13:41:48 -05:00
Charles Kerr ce10a5314a
fixup! fix: ensure all bytes read / written to file (#2682) (#2780)
fix: infinite loop when pread returns 0
2022-03-17 10:41:02 -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 72a67054ea
refactor: fmt part 2 (#2771) 2022-03-15 09:52:16 -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 91d5388954
fix: memory corruption in RPC when fetching torrent piece info (#2762)
Thanks to MatanZ for finding and tracking down this problem

Fixes #2757.
2022-03-12 10:39:34 -06:00
Charles Kerr 749bb591fb
feat: stop logging repetitive warnings (#2756)
Fixes #295
2022-03-11 16:06:58 -06: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
Charles Kerr 1bafbd18ac
chore: add more descriptive assertion in bitfield (#2748)
Related to #2727
2022-03-09 17:43:42 -06:00
Charles Kerr 7a227917ff
fix: rpc-server shutdown assertion failure (#2747)
Fixes #2742.
2022-03-09 11:13:51 -06:00