Commit Graph

102 Commits

Author SHA1 Message Date
Charles Kerr 64d9d57363
chore: fix minor clang-tidy warnings (#6275) 2023-11-21 09:02:03 -06:00
Yat Ho a2b547fb50
chore: iwyu (#6201) 2023-11-03 12:03:26 -05:00
Julien 8ac323d5d6
chore: removed copyright timespans in headers (#4850) 2023-11-01 16:11:11 -05:00
Cœur 1722f00777
chore: apply clang-format version 17.0.1 (#6054) 2023-10-01 18:45:52 -05:00
Yat Ho eea7d4d886
refactor: re-organise `net.h` member functions (#5878) 2023-08-17 22:13:01 -05:00
tearfur f758cb3597
refactor: avoid code duplication (#5793) 2023-07-17 08:56:57 -05:00
Charles Kerr a9a6e54858
refactor: make tr_socket_address a class (#5772) 2023-07-12 17:29:47 -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 f83a60830a
refactor: add tr_socket_address typedef (#5730) 2023-07-05 11:33:50 -05:00
tearfur 8543555584
refactor: use `std::pair` to store socket addresses (#5723) 2023-07-04 20:29:12 -05:00
tearfur 9c17463a80
fix: revert "perf: improve IPv4 `tr_address` comparison" (#5709)
* Revert "perf: improve IPv4 `tr_address` comparison (#5651)"

This reverts commit 70decc1d9d.

* added tests

* add ipv4 equal test and std header
2023-07-01 09:39:35 -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 ce66e5c442
iwyu: remove, add std headers where used (#5694)
* chore: remove unused #include <array>

* chore: remove unused #include <chrono>

* chore: remove unused #include <set>

* chore: remove unused #include <algorithm>

* chore: remove unused #include "interned-string.h"

* chore: remove unused #include <list>

* chore: remove unused #include <optional>

* chore: iwyu <cstddef>

* chore: iwyu <ctime>

* chore: remove unused #include <cerrno>

* chore: remove unused #include <deque>

* chore: remove unused #include <vector>

* chore: remove unused #include <memory>

* chore: remove unused #include <unordered_set>

* chore: remove unused #include <array>

* chore: remove unused #include <mutex>

* chore: remove unused #include <functional>

* chore: remove unused #include <cmath>
2023-06-29 23:51:55 -05:00
tearfur 70decc1d9d
perf: improve IPv4 `tr_address` comparison (#5651) 2023-06-26 21:17:32 -05:00
tearfur 280dea4e33
add support for sending the `ipv4` parameter during ltep handshake (#5643) 2023-06-20 10:51:07 -05:00
tearfur d65f9329cd
refactor: followup/cleanup of `tr_global_ip_cache` PR (#5498)
* remove tr_session::bindAddress()

* replace tr_net_hasIPv6 with tr_session::has_ip_protocol()

* update comment
2023-05-05 22:05:28 -05:00
tearfur 474a30ab2d
feat: add global IP cache, fix UDP connection failure warnings 2023-05-05 12:17:40 -05:00
Gary Elshaw 2f1d5a225c
fix: comment typos in libtransmission (#5473) 2023-04-30 13:29:29 -05:00
Charles Kerr 3af9645615
refactor: add tr_address::is_any() (#5398)
As suggested by @tearfur

Xref: https://github.com/transmission/transmission/pull/5329#discussion_r1166236165
2023-04-15 19:30:20 -05:00
Charles Kerr d72cb67cfb
chore: include directory name in libtransmission #includes (#5308) 2023-04-14 14:33:23 -05:00
tearfur e68c72daa4
fix: tr_net_hasIPv6() (#5312) 2023-03-28 13:41:07 -05:00
tearfur 85a00625dc
fix: intermediate fix for HTTP announce behaviour affected by `bind-address-ipv*` (#5296) 2023-03-28 12:59:42 -05:00
Julien 4b8cfa2e57
chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
Charles Kerr 0e5f7f86d7
fix: coverity warnings (#4687)
* fix: minor tr_error leak warning in tests

* fix: socket leak in tr_globalIPv6()
2023-01-29 16:49:59 -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 c75f9a4a7a
refactor: tidy libtransmission symbol visibility (#4680) 2023-01-27 14:25:08 -06:00
Charles Kerr 568b23374c
chore: don't warn on ECONNREFUSED to peer sockets. (#4678)
Fixes #1031.
2023-01-27 00:00:00 -06:00
Charles Kerr 977a190646
fix: msvc warnings (#4651)
* fix: C4189 local variable is initialized but not referenced

* fix: C4706 assignment within conditional expression

* fix: C4018 signed/unsigned mismatch

* fix: warning C4996 High-DPI scaling is always enabled.

* fix: C4996: QApplication::fontMetrics() is deprecated

eed5514eaf
2023-01-23 19:24:52 -06:00
Charles Kerr 7367d465b5
style: use the new paragraph comment style everywhere (#4634) 2023-01-22 13:21:30 -06:00
Charles Kerr 9678b26984
refactor: misc-use-anonymous-namespace pt. 3 (#4539) 2023-01-07 08:27:54 -06:00
Charles Kerr b47c34726b
refactor: tr_peer_socket keeps track of peer count (#4534) 2023-01-04 15:37:55 -06:00
Charles Kerr 106bcbbe7b
fix: clang-tidy-15 warnings (#4525) 2023-01-03 14:10:12 -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 a3f561bcc0
refactor: add tr_address.is_global_unicast_address() (#4462)
Was previously private to net.cc. Expose here so that we can add tests.

Add tests.
2022-12-24 18:53:50 -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 22a3a5db25
refactor: peer-socket pt 2 (#4326)
* refactor: tr_netOpenPeerSocket() now takes a tr_address reference

* refactor: disable copy assignment, copy constructor

* refactor: move log statements to peer_socket constructor
2022-12-06 10:28:28 -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 f03fc9270b
Fix/long shutdown crash on shutdown (#4285) 2022-11-30 13:00:34 -06:00
Charles Kerr 42f26aad0b
fix: ftbfs on Windows (#4204) 2022-11-16 18:03:48 -06:00
Charles Kerr 36edd516aa
refactor: replace tr_boundinfo with tr_session::BoundSocket (#4103) 2022-11-06 10:35:48 -06:00
A Cœur 64b5fde8b2
fixup: silence "empty expression statement has no effect" warning (#4074) 2022-11-02 09:04:22 -05:00
Charles Kerr 611d36ac84
refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
Charles Kerr 798e873b87
fix: sonarcloud warnings (#4023) 2022-10-24 22:13:09 -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 572e1bb50f
refactor: add tr_address::fromSockaddr() (#3964)
* refactor: remove TR_DISCARD_ALIGN

* refactor: add tr_address::fromSockaddr()
2022-10-14 01:20:39 -05:00
Charles Kerr fff4c87740
refactor: add tr_address::toSockaddr() (#3870) 2022-10-04 14:52:51 -05:00