Commit Graph

145 Commits

Author SHA1 Message Date
Charles Kerr 611b181a99
feat: add `yourip` to extension protocol handshake (#4504)
* feat: add yourip to the extension protocol handshake
2023-01-01 12:20:46 -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 07a5e560b7
fixup: peer counts (#4445) 2022-12-22 17:43:36 -06:00
Charles Kerr e6d75a4b77
refactor: tr_peerIo (#4372) 2022-12-16 01:23:12 -06:00
Charles Kerr 0a69685a4e
refactor: tr_address cleanup (#4338)
* refactor: move tr_tracker_http_announce() helper funcs into their own namespace

* refactor: move tr_globalIPv6() helper funcs into their own namespace

* refactor: move tr_address_is_valid_for_peers() helper funcs into their own namespace

* refactor: make tr_address_compare() a private method

* refactor: rename tr_address::isIPv4() to is_ipv4()

* refactor: use snake_case for tr_address methods

* refactor: make tr_address_is_valid_for_peers() a member function
2022-12-08 20:27:52 -06:00
Charles Kerr 0061e4f9a9
refactor: tr_address::display_name() (#4335) 2022-12-08 16:44:19 -06:00
Charles Kerr f176bb299a
fix: broken detection of peer udp port (#4334) 2022-12-08 14:44:39 -06:00
Charles Kerr 9a5d9a0ba2
refactor: tr_peer_socket (#4325)
* refactor: make tr_peer_socket.type private

* refactor: reimplement tr_peerIo::address() as a wrapper around tr_peer_socket::address()

* refactor: remove tr_address, tr_port from tr_peerIo

* refactor: replace tr_netClosePeerSocket() with tr_peer_socket::close()
2022-12-05 18:53:31 -06:00
Charles Kerr 728e5b8350
refactor: stop tracking peerIo creation time (#4300) 2022-12-02 10:39:46 -06:00
A Cœur e038121857
refactor: second log of UTP errors as 'trace' messages (#4283) 2022-11-30 14:06:08 -06:00
Charles Kerr 8900a1646e
refactor: do not report peer EOF as an error (#4275) 2022-11-29 10:48:20 -06:00
Charles Kerr 59335eac03
fix: sonarcloud cpp:S6004 (#4270)
reduce scope of variables by using if-based initializer
2022-11-28 21:03:28 -06:00
Charles Kerr f27c5fa0fa
refactor: make some local pointer vars pointer-to-const (#4262) 2022-11-28 09:45:39 -06:00
Charles Kerr 554ba06ae2
fix: coverity warnings, sonarcloud code smells (#4232) 2022-11-24 10:17:02 -06:00
Charles Kerr a8f2b840f7
perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
Charles Kerr 09bb1a60f0
refactor: add more nodiscard, constexpr, and noexcept (#4089) 2022-11-03 18:08:02 -05:00
Charles Kerr 611d36ac84
refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
Charles Kerr cdf817f2e7
fix: FTBFS on Windows (#4036)
* refactor: getPiececLength() now returns size_t

* refactor: tr_torrentSetMetadataPiece() length arg is now size_t

* refactor: tr_peerIo::flushOutgoingProtocolMsgs() returns size_t, takes a tr_error** for reporting errors

* refactor: define tr_mode_t for convenience

* fix: suseconds_t portability fix
2022-10-28 19:12:37 -05:00
A Cœur 12e564096b
fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
Charles Kerr e8079835d3
fix: crash when a torrent autopauses after encountering an error (#4021) 2022-10-24 16:57:07 -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 450f1dcadc
refactor: extract `tr_buffer` class from `tr_peerIo` (#3986) 2022-10-19 11:42:08 -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
Charles Kerr 0a0c15d17c
fix: circular dependency in udp core and dht init (#3862) 2022-10-02 13:18:23 -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 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 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
Charles Kerr dd12fd010a
chore: iwyu headers (#3833) 2022-09-21 18:34:18 -05:00
Charles Kerr 9fb590d3f5
fix: recent coverity warnings (#3788)
* fix: suppress intentional USE_AFTER_FREE in tests

* fix: unnecessary field check

* fix: in ~tr_verify_worker(), release mutex lock before waiting
2022-09-07 19:24:56 -05:00
Charles Kerr 1782dc6d7a
refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
Charles Kerr 8eab7d3ae7
chore: remove dead "fast set" code (#3764)
* chore: remove old fast set code

* chore: remove TR_SHA1_DIGEST_LEN declaration

* chore: remove TR_SHA256_DIGEST_LEN declaration
2022-09-05 08:55:17 -05:00
Charles Kerr b01eebdaf4
refactor: tr_peer_event (#3746) 2022-09-01 16:37:11 -05:00
Charles Kerr b7ea4d9f04
refactor: tr_peerIo ref, unref (#3735)
* refactor: replace manual peerIo refcounting with std::shared_ptr
2022-08-30 12:38:30 -05:00
Charles Kerr 7c014e3256
Refactor/tr peer io member funcs (#3734)
* refactor: make tr_peerIoSetEnabled() a member method

* refactor: make tr_peerIoFlushOutgoingProtocolMsgs() a member method

* refactor: make tr_peerIoFlush() a member method

* refactor: make tr_peerWriteBytes() a member method

* refactor: make tr_peerWriteBuf() a member method

* refactor: make tr_peerIoGetWriteBufferSpace() a member method

* chore: remove unused declaration

* refactor: make tr_peerIoUtpInit() a member method

* refactor: make tr_peerIoNew() a member method

* refactor: make tr_peerIoNewOutgoing() a member method

* refactor: make tr_peerIoNewIncoming() a member method
2022-08-29 15:58:18 -05:00
Charles Kerr 0ed595ca0e
refactor: tr_peerIo read buffer (#3732)
* refactor: make tr_peerIoReadBytes() a member method

* refactor: make tr_peerIoReadUint8() a member method

* refactor: make tr_peerIoReadUint16() a member method

* refactor: make tr_peerIoReadUint32() a member method

* refactor: make tr_peerIoSetIOFuncs() a member method

* refactor: make tr_peerIoReconnect() a member method

* refactor: make tr_peerIoClear() a member method

* refactor: make tr_peerIoDrain() a member method

* refactor: move evbuffer_add_hton_16() impl to cc
2022-08-29 13:33:08 -05:00
Charles Kerr cee339e10d
refactor: remove tr_removeElementFromArray() (#3731) 2022-08-28 21:51:26 -05:00
Charles Kerr a24679d89f
refactor: modernize-avoid-c-arrays pt. 2 (#3713) 2022-08-26 13:35:28 -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 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 5c8695025a
refactor: make tr_session.is_closing_private_ (#3637) 2022-08-13 20:04:36 -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 63eab54fd5
refactor: timer pt 2 (#3617)
* feat: add convenience variants of TimerMaker::create()

* refactor: use libtransmission::Timer in peer-mgr

* refactor: use libtransmission::Timer in peer-msgs

* refactor: use libtransmission::Timer in tr-utp

* refactor: use libtransmission::Timer in tr-dht

* refactor: use libtransmission::Timer in port-forwarding

* refactor: use libtransmission::Timer in webseed

* refactor: use libtransmission::Timer in tr-lpd

* refactor: use libtransmission::Timer in rpc-server

* chore: remove unused function tr_timerAdd()

* chore: remove unused function tr_gettimeofday()

* fixup! chore: remove unused function tr_timerAdd()

* fixup! refactor: use libtransmission::Timer in port-forwarding
2022-08-11 12:28:37 -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 868fc1ab78
Refactor/tr variant from buf (#3592)
* refactor: use std::string in tr_watchdir_inotify_on_event()

* refactor: add template tr_variantFromBuf() variant

if it has .data() and .size() it is good
2022-08-05 16:12:45 -05:00
Charles Kerr 3428076ecd
fix: cppcoreguidelines-special-member-functions warnings in libtransmission (#3575) 2022-08-03 12:03:28 -05:00
Charles Kerr dab81c1af6
fix: readability-inconsistent-declaration-parameter-name warnings in libtransmission (#3572) 2022-08-03 01:15:37 -05:00