Commit Graph

146 Commits

Author SHA1 Message Date
Yat Ho e39045cf69
refactor: tidy up announcer code (#5945) 2023-09-01 16:51:58 -05:00
Charles Kerr fbfbfac3ae
fix: minor coverity warnings (#5916)
* fix: unchecked return value from tr_variantDictFindInt()

coverity 1541113

* fix: unchecked return value from tr_variantDictFindBool()

coverity 1541112

* fix: copy-instead-of-move in tr_strlower()

coverity 1541092

* fix: use auto& instead of auto in test

coverity 1541084

* fix: logically dead code

coverity 1541065

* fix: copy-instead-of-move in tr_announcer_impl::addTorrent()

coverity 1541062

* fix: unchecked return value of tr_variantDictFindInt()

coverity 1541061

* fix: copy-instead-of-move in FilterBar::Impl::tracker_filter_model_update()

coverity 1541058

* fix: copy-instead-of-move in gtr_window_on_close()

* fix: silence invalid resource leak warning

coverity 1520595

* fix: unchecked return value from setsockopt()

coverity 1518345

* fix: dereference after null check (FORWARD_NULL)

coverity 1517816
2023-08-21 21:59:47 -05:00
Charles Kerr ea9fd64830
refactor: tr_compare_3way() (#5799) 2023-07-15 21:55:44 -05:00
tearfur 5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
Charles Kerr fdf042d32c
refactor: add tr_compare_3way() (#5742)
* refactor: add tr_compare_3way()

This is a small templated utility function to make libtransmission's
sorting / comparison code more consistent and easier to read.
2023-07-06 18:51:08 -05:00
Charles Kerr c364abcb6f
chore: misc-include-cleaner (partial) (#5738) 2023-07-06 10:00:07 -05:00
Charles Kerr 6a2a4c3032
perf: move log strings instead of cloning them (#5726) 2023-07-04 14:03:45 -05:00
Charles Kerr 8183d7fddf
refactor: utils naming (#5696)
* chore: rename tr_strvContains to tr_strv_contains

* chore: rename tr_strvStartsWith to tr_strv_starts_with

* chore: rename tr_strvEndsWith to tr_strv_ends_with

* chore: rename tr_strvSep to tr_strv_sep

* chore: rename tr_strvStrip to tr_strv_strip

* chore: rename tr_strvToBuf to tr_strv_to_buf

* refactor: rename tr_saveFile() to tr_file_save()

rename tr_loadFile() to tr_file_read()

rename tr_moveFile() to tr_file_move()

* refactor: rename tr_parseNum() to tr_num_parse()

refactor: rename tr_parseNumRange() to tr_num_parse_range()

* chore: group related functions together in header
2023-06-30 09:49:58 -05:00
Charles Kerr c61d8b7cf7
refactor: rename tr_tracker_view.host to .host_and_port for clarity (#5508) 2023-05-08 20:28:10 -05:00
Charles Kerr 0d3b321bac
refactor: use snake_case for libtransmission class methods (#5497) 2023-05-05 23:11:05 -05:00
tearfur 474a30ab2d
feat: add global IP cache, fix UDP connection failure warnings 2023-05-05 12:17:40 -05:00
Charles Kerr 9d2507c7e3
refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -05:00
midzer 68e965aa28
perf: pass by reference (#4876) 2023-04-14 17:06:26 -05:00
Charles Kerr d72cb67cfb
chore: include directory name in libtransmission #includes (#5308) 2023-04-14 14:33:23 -05:00
Charles Kerr 25f38d5ff3
fix: wrong tier value in torrent get tracker stat response (#5274) 2023-03-21 20:23:08 -05:00
Charles Kerr 5cc3bf8a97
fix: generate peer-id on launch (#5233) 2023-03-15 20:53:48 -05:00
reardonia 56c1bb2a9e
fix: publish 'leechers' iff it was in tracker response (#5164) 2023-03-06 09:22:40 -06:00
Julien 4b8cfa2e57
chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
Berbe b155374137
fix: add nullptr dereference safguard in announcer code 2023-02-11 08:25:28 -06:00
Charles Kerr 93db8f088a
fix: cppcoreguidelines-pro-type-cstyle-cast (#4685)
* fix: libtransmission cppcoreguidelines-pro-type-cstyle-cast

* fix: libtransmission cppcoreguidelines-avoid-do-while

* refactor: inline static class fields

* fix: libtransmission cppcoreguidelines-avoid-reference-coroutine-parameters

* fix: announcer.cc cppcoreguidelines-narrowing-conversions
2023-01-28 15:26:23 -06:00
Charles Kerr b5c9e3d697
fix: clang-tidy warnings in libtransmission/transmission.h (#4628) 2023-01-21 13:49:43 -06:00
Cœur e4c5981545
feat: log which tracker is giving a warning (#4544) 2023-01-17 01:46:43 -06:00
Dmitry Antipov bd461e1081
refactor: use std::function for announcer callback (#4575) 2023-01-15 12:37:54 -06:00
Dmitry Antipov 0af121004c
chore: remove unused callback arg (#4573) 2023-01-10 14:47:53 -06:00
Charles Kerr cb10255ef1
refactor: misc-use-anonymous-namespace pt. 4 (#4550) 2023-01-07 12:58:16 -06:00
Charles Kerr 9678b26984
refactor: misc-use-anonymous-namespace pt. 3 (#4539) 2023-01-07 08:27:54 -06:00
Charles Kerr 453836f324
refactor: make announce key param unique per-torrent (#4508) 2023-01-01 13:22:50 -06:00
Mike Gelfand 5fd0aff818
Automatically (re)order include directives (GTK client) (#4475)
* Automatically (re)order include directives (GTK client)

Include our headers first to ease IWYU enforcement.

* Fix includes missing from headers (GTK client)

* Fix build on Mac after includes reordering
2022-12-26 21:13:21 +00:00
Charles Kerr 14a3d01e45
fix: sonarcloud (#4453) 2022-12-23 10:56:27 -06:00
Charles Kerr 092d411663
refactor: tr_rand_buffer(), tr_rand_int() again (#4415) 2022-12-21 09:58:32 -06:00
Charles Kerr e6d75a4b77
refactor: tr_peerIo (#4372) 2022-12-16 01:23:12 -06:00
Cœur 669faf7474
Dropped tr_rand_int_weak where possible. (#4271) 2022-12-14 12:21:56 -06:00
Charles Kerr f03fc9270b
Fix/long shutdown crash on shutdown (#4285) 2022-11-30 13:00:34 -06:00
Charles Kerr 595d0ac14a
refactor: add tr_announcer.startShutdown() (#4280) 2022-11-29 21:05:11 -06:00
Charles Kerr 4adda4dc1e
fix: sonarcloud cpp:S6005 (#4268) 2022-11-28 18:26:03 -06:00
Charles Kerr feeea2649e
refactor: make tr_announcer.key a uint32_t (#4241) 2022-11-25 19:11:55 -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 19bc15523f
fix: new sonarcloud, coverity, gcc warnings (#4229) 2022-11-23 13:47:04 -06:00
Charles Kerr 046ba32d33
fixup: heap-use-after-free in announce, scrape response on shutdown (#4228)
fixes #4222.
2022-11-23 01:38:31 -06:00
Charles Kerr a3772dc1fa
refactor: aggregate dh in peer io (#4218) 2022-11-21 18:08:06 -06:00
A Cœur d26db72d7e
Fix "Implicit conversion loses integer precision" (#4194) 2022-11-21 10:19:45 -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 d61e31c419
fix: more thread safety updates (#4136)
* fix: thread safety in tr_sessionLoadTorrents()

* refactor: use std::future in tr_sessionSet()

* refactor: use std::future in tr_sessionClose()
2022-11-10 12:04:49 -06:00
Charles Kerr 611d36ac84
refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -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
Charles Kerr d191a04228
refactor: decouple tr_announcer_udp (#4002) 2022-10-21 13:15:14 -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
Charles Kerr 56e0a1bda8
chore: add cppcoreguidelines-pro-type-member-init to libtransmission/.clang-tidy (#3840) 2022-09-23 00:51:15 -05:00
Charles Kerr 1782dc6d7a
refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00