Commit Graph

55 Commits

Author SHA1 Message Date
Charles Kerr b47c34726b
refactor: tr_peer_socket keeps track of peer count (#4534) 2023-01-04 15:37:55 -06:00
Charles Kerr dc968892ec
fix: Couldnt send to IPv6 address warnings (#4527) 2023-01-03 21:12:05 -06:00
Charles Kerr 24eb6ef293
fix: use SO_REUSEADDR when binding UDP ports (#4513)
* fix: use SO_REUSEPORT when binding UDP ports

* chore: cast 3rd arg of setsockopt
2023-01-01 20:36:20 -06:00
Charles Kerr d338eb3bdc
refactor: simplify tr_udp_core::sendto() (#4510) 2023-01-01 17:16:13 -06:00
Charles Kerr 53f5a33616
fix: fix omitted fmt call (#4494) 2022-12-31 10:49:27 -06:00
Charles Kerr 5ce503f1ab
refactor: udp_core constructor (#4469)
* refactor: udp_core constructor

* refactor: invert dependency between tr_session.publicAddress() and tr_globalIPv6()
2022-12-28 02:03:35 -06:00
Charles Kerr ab9e971903
refactor: tr_globalIPv6() returns a std::optional<tr_address> (#4464) 2022-12-25 07:55:51 -06:00
Charles Kerr 6f1153cae4
refactor: tr_handshake (#4362) 2022-12-13 19:58:39 -06:00
Cœur 4a80f800a6
Fixed crash on exit in tr_utpPacket (#4348) 2022-12-13 16:51:54 -06:00
Charles Kerr 0061e4f9a9
refactor: tr_address::display_name() (#4335) 2022-12-08 16:44:19 -06:00
Charles Kerr 9e06cf8f2e
refactor: make DHT unblocking (#4122) 2022-11-11 10:09:24 -06:00
Charles Kerr 4d8509c180
refactor: add libtransmission::evhelpers (#4104) 2022-11-06 15:11:30 -06:00
A Cœur 12e564096b
fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
Charles Kerr d191a04228
refactor: decouple tr_announcer_udp (#4002) 2022-10-21 13:15:14 -05:00
Charles Kerr 79068c512a
refactor: decouple tr-dht from peerMsgs, peerMgr (#3966)
* refactor: decouple peer-mgr from tr-dht

* refactor: remove tr_dhtPort()

* refactor: decouple peer-msgs from tr-dht

* refactor: make tr_udp_core.udp_port_ const

* refactor: rename tr_udp_core::dhtUninit() as startShutdown()
2022-10-15 08:22:43 -05:00
Mike Gelfand f1f55cc3df
Sync translations (#3939)
* Sync translations with code

* Sync translations with Transifex

* Remove Mac menu title that isn't displayed and shouldn't be translated

* Add context to logging level strings in GTK client

* Use "µTP" consistently in code

* Use ellipsis instead of three docs in Qt client strings

* Close HTML tags in blocklist-related strings

* Remove trailing space from a translatable string in Qt client

* Add missing plural forms for English strings in Qt client

* Fix spelling: metaInfo -> metainfo
2022-10-11 18:39:41 +03:00
Charles Kerr 0a0c15d17c
fix: circular dependency in udp core and dht init (#3862) 2022-10-02 13:18:23 -05:00
Charles Kerr a5ca289f41
fix: #3847 crash on session close (#3849)
* chore: use typesafe sin_addr assignment instead of memcpy()

* refactor: make tr_dhtPrintableStatus private

* refactor: make tr_dhtStatus() private

* refactor: make tr_dht status enum private

* refactor: add safety mutex wrapper around libdht API calls

* refactor: make tr_dht::Status an enum class

* refactor: rename private functions

* refactor: const correctness

* refactor: use typesafe assignment instead of memcpy

* refactor: tr_session does not directly call tr_dht

* refactor: tr_dhtPort() returns std::optional

* refactor: use tr_address::fromCompact4 in tr-dht.cc
2022-09-29 09:12:33 -05:00
Charles Kerr 326d9f3daf
refactor: cppcoreguidelines-avoid-goto (#3841)
* refactor: do not use goto in file-win32.cc

* refactor: do not use goto in subprocess-posix.cc

* refactor: do not use goto in peer-io.cc

* build: add cppcoreguidelines-avoid-goto to libtransmission/.clang-tidy
2022-09-23 08:39:13 -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 228efa16e3
refactor: tr_globalIPv6() returns a std::optional<in6_addr> (#3836) 2022-09-21 23:59:31 -05:00
Dmitry Antipov 243ab1058d
refactor: fold session UDP innards into C++ class (#3794)
* Use std::unique_ptr to manage UDP core object

N.B.: it's no longer valid to call socket adjustments quirks from
tr_sessionSetUTPEnabled() because the corresponding object may be
not created yet. We have to create (or re-create) it explicitly
(like it's done in tr_sessionSetDHTEnabled()) or just set
is_utp_enabled_ flag of the session and assume that socket
adjustments will be done later when the object is constructed.
2022-09-21 13:25:53 -05:00
Charles Kerr d17341d784
refactor: constify (#3780) 2022-09-06 12:52:58 -05:00
Charles Kerr e191407dee
refactor: modernize-avoid-c-arrays pt. 1 (#3702) 2022-08-24 20:19:21 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr 0fbfed60b1
refactor: make tr_session.speed_limit_Bps_ private (#3645)
* refactor: make tr_session.speed_limit_Bps_ private

* refactor: make tr_session.is_utp_enabled_ private

* refactor: make tr_session.is_prefetch_enabled_ private

* refactor: make tr_session.is_ratio_limited_ private

* refactor: make tr_session.upload_slots_per_torrent_ private

* refactor: make tr_session.peer_id_ttl_hours_ private

* refactor: make tr_session.blocklists_ private

* refactor: make tr_session.umask_ private

* refactor: make tr_session.evdns_base_ private

* fixup! refactor: make tr_session.blocklists_ private

* refactor: make tr_session.default_trackers_ private

* refactor: make tr_session.idle_limit_minutes_ private

* refactor: make tr_session.WebMediator private

* refactor: make tr_session.session_id_ private

* refactor: make tr_session.peer_socket_tos_ private
2022-08-15 12:48:05 -05:00
Charles Kerr 44a291ca39
refactor: remove tr_session nonmember functions (#3641) 2022-08-14 14:41:57 -05:00
Charles Kerr 08ec882055
refactor: remove tr_isSession() (#3638) 2022-08-14 09:16:08 -05:00
Charles Kerr b49cccbd3e
refactor: add timer class (#3603)
Wraps around evtimer so that some of the codebase can use libevent without coupling to it.
2022-08-08 17:53:20 -05:00
Charles Kerr ec79a2a888
fix: clang-tidy misc-const-correctness warnings (#3529) 2022-07-27 09:03:13 -05:00
Charles Kerr 71bc7143b8
Revert "refactor: tr_address cleanup (#3422)" (#3426)
This reverts commit 9a44eeaa27.
2022-07-09 18:44:20 -05:00
Charles Kerr 9a44eeaa27
refactor: tr_address cleanup (#3422)
* refactor: remove tr_address_compare()

* refactor: remove tr_address_to_string()

* refactor: remove NUM_TR_AF_INET_TYPES

* refactor: replace tr_sessionGetPublicAddress with tr_session::getPublicAddress()

* refactor: tr_peerIo() takes tr_address by value

* refactor: replace tr_sessionIsAddressBlocked with tr_session::isAddressBlocked()

* refactor: tr_peerMgrAddIncoming now takes tr_address by value

* refactor: replace tr_address_is_valid_for_peers() with tr_address.isValidForPeers()

* refactor: tr_netOpenPeerSocket takes tr_address by value

* refactor: remove tr_generateAllowedSet()

* refactor: setup_sockaddr takes a tr_address by value

* refactor: tr_netBindTCP() takes a tr_address by value

* refactor: tr_dhtAddNode() takes a tr_address by value

* refactor: remove tr_address_from_string()

* refactor: rename tr_address.isValidForPeers() to .isValidPeerAddress()

* refactor: replace tr_address_from_sockaddr_storage() with tr_address::fromSockaddrStorage()

* refactor: minor cleanup to tr_address::readable()
2022-07-08 13:23:41 -05:00
Charles Kerr 256b436023
fix: clang 15 warnings (#3172)
* fix modernize-macro-to-enum libtransmission warnings

* fix readability-simplify-boolean-expr libtransmission warnings

* fix bugprone-unchecked-optional-access libtransmission warnings
2022-06-01 11:56:59 -05:00
Charles Kerr 46eb379205
fix: ESPIPE "illegal seek" error while seeding (#3137)
* fix: ESPIPE "illegal seek" error while seeding

The root cause is createSocket returning `{}` instead of `TR_BAD_SOCKET`
when we have too many peers in use. This defaulted to fd 0, which wound
up closing stdin.

Commit also includes some const-correctness changes made while tracking
the problem down.
2022-05-25 18:16:15 -05:00
Charles Kerr 41cb8cbc91
refactor: add tr_address.readable (#2962) 2022-04-21 18:37:02 -05:00
Charles Kerr 32f854a7cf
refactor: add a tr_port safety class (#2952) 2022-04-21 10:58:13 -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 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 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 e94ddc82fc
refactor: use std::string in tr_net_strerror() (#2706) 2022-02-24 18:53:01 -06:00
Charles Kerr 9688e3ca1e
refactor/remove-unused-utp-includes (#2650) 2022-02-18 18:56:53 -06:00
Charles Kerr 6383e2ff5f
feat: support dscp classes in socket iptos (#2594)
* refactor: Replace ToS with DSCP

IP TOS was superseded by DSCP in RFC 2474.

Co-authored-by: dgcampea <dgcampea@outlook.com>
2022-02-10 15:35:28 -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 2d916ab9a8
fixup! Fixed wrong ipv6 addr used in announces. (#265) (#2464)
fix unused variable warning
2022-01-20 16:34:43 -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 3d38e01a13
refactor: tr_session.congestion (#2151)
* refactor: tr_session.congestion
2021-11-14 00:41:44 -06:00
Dan Walters 8234d064a8
fix: apply optional peer socket TOS to UDP sockets (#1043)
This effectively makes the TOS setting apply to uTP and DHT traffic.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-26 20:59:31 -05:00