Commit Graph

6056 Commits

Author SHA1 Message Date
Charles Kerr 8f7330523c
chore: remove unused progress arg from tr_torrentSetLocation() (#6147) 2023-10-21 22:33:41 -04:00
Yat Ho 2130eb941a
refactor: drop jsonsl in favour of RapidJSON (#6138) 2023-10-21 14:00:12 -05:00
Charles Kerr 0457dcb6a8
refactor: make tr_torrent::files_wanted_ private (#6146) 2023-10-21 13:21:05 -05:00
Charles Kerr 8c1291ce8a
refactor: make tr_torrent::unique_id_ private (#6145) 2023-10-20 21:23:14 -05:00
Charles Kerr 9e5c528056
refactor: add tr_torrent::stat() (#6143) 2023-10-20 20:35:59 -05:00
Yat Ho 88fe76781c
perf: connectable pool housekeeping (#6111) 2023-10-19 13:05:19 -05:00
Charles Kerr 4bdb3066d8
refactor: decouple tr_verify_worker from tr_torrent (#6123) 2023-10-19 08:39:34 -05:00
Yat Ho c70c49e87b
fix: encode `ip` in network byte order for udp announce (#6126) 2023-10-18 09:46:57 -05:00
Charles Kerr 0c3f65e1c6
fix: FTBFS on FreeBSD with clang 14 (#6110) 2023-10-16 19:39:14 -05:00
Yat Ho 0259edbaf3
fix: json string serializer improperly escaping characters (#6005)
* feat: escape json string according to RFC8259

* fix: do not append newline when json serde is in compact mode

* fix: json tests

1. Use the same locale settings as the apps
2. Added additional test case for a string that are known to be prone to locale issues
3. Removed test for escaping non-BMP characters to UTF-16 escape sequences

* chore: add more test cases to `JSONTest.testUtf8`

* chore: order cases in the same order as RFC8259
2023-10-16 19:36:37 -05:00
Yat Ho 6cec60f1fb
refactor: store outgoing handshake in `tr_peer_info` objects (#6103) 2023-10-14 12:58:15 -05:00
Yat Ho 43aff088d8
fix: only consider piece data in bandwidth limit (#6082)
* fix: only consider piece data in bandwidth limit

* refactor: remove unused `tr_bandwidth::clamp()` signature
2023-10-09 08:49:49 -05:00
Charles Kerr db96771c80
refactor: add tr_torrent::Error helper class (#6077) 2023-10-08 21:33:34 -05:00
Yat Ho 0c52b710ad
feat: add option to force verify torrent in WebUI (#5981) 2023-10-06 22:52:59 -05:00
Yat Ho 2c97567370
chore: minor housekeeping for bandwidth code (#6080) 2023-10-06 18:30:04 -05:00
Charles Kerr ce39b01dd2
perf: reduce unnecessary size overhead in tr_torrent struct (#6073) 2023-10-04 21:38:14 -05:00
Yat Ho c6236c7bee
fix: reconstruct `utp_core_` when toggling utp (#6075) 2023-10-04 20:33:18 -05:00
Charles Kerr 3f7340502f
refactor: add a SimpleSmoothedSpeed helper class (#6072) 2023-10-04 17:40:46 -05:00
Yat Ho 93e8bf7330
fixup! refactor: make tr_torrent idle fields private (#6070) (#6074)
Thanks!
2023-10-04 16:33:04 -05:00
Charles Kerr 68f3c89e3c
refactor: make tr_torrent idle fields private (#6070) 2023-10-03 20:18:55 -05:00
Charles Kerr 32a62d85ea
refactor: more tr_variant API (#6057) 2023-10-02 16:18:35 -05:00
Charles Kerr 917c00e477
refactor: remove tr_torrentStatCached() (#6066) 2023-10-02 14:07:28 -05:00
Yat Ho 5808f72f50
fix: assertion failed: port_empty in `tr_swarm::remove_peer()` (#6062) 2023-10-02 11:57:48 -05:00
Yat Ho 170f589b64
fixup! refactor: remove redundant code when adding announce lists to metainfo (#6050) (#6061) 2023-10-02 10:18:38 -05:00
Yat Ho ee4daa059d
feat: check if files are missing after setting location (#5978) 2023-10-01 19:21:18 -05:00
Cœur 1722f00777
chore: apply clang-format version 17.0.1 (#6054) 2023-10-01 18:45:52 -05:00
Yat Ho cfa26d0da8
chore: more specific peer error log (#6029) 2023-10-01 10:43:17 -05:00
Charles Kerr 55da783e8f
refactor: remove redundant code when adding announce lists to metainfo (#6050) 2023-09-30 07:31:43 -05:00
Yat Ho 82a9aa6cf0
fix: correct log output (#6048) 2023-09-29 21:37:14 -05:00
hgy59 cf426d8f81
fix: tr_sys_path_copy in file-posix.cc for some Synology Devices (#5966) (#5974) 2023-09-29 19:34:51 -05:00
Yat Ho 7973d873ff
feat: BT and MSE handshake rework (#6025) 2023-09-26 12:50:41 -05:00
Yat Ho 51995ab63f
fix: remove redundant `tr_lpd::create()` call (#5900) 2023-09-25 22:46:41 -05:00
Charles Kerr 114885d67b
fixup! refactor: tr_variant API update (#5998) (#6036)
fix use of invalidated pointer in rpcipml
2023-09-25 13:24:46 -05:00
Charles Kerr 6ead147620
refactor: use new tr_variant API in tr_session (#6006) 2023-09-16 08:23:35 -05:00
Yat Ho 85a120faea
feat: add `preferred-transport` to settings.json (#5939) 2023-09-15 20:23:34 -05:00
Charles Kerr 9a82372e95
refactor: tr_variant API update (#5998) 2023-09-13 08:49:17 -05:00
luzpaz 3be0d728dd
Fix typos (#5980) 2023-09-10 22:31:49 -05:00
Yat Ho d566695b33
fix: always move duplicate peer_info to graveyard pool (#5941) 2023-09-10 21:12:11 -05:00
Charles Kerr ebb1b775af
refactor: public tr_session settings API now returns tr_variants (#5983) 2023-09-07 19:05:16 -05:00
chantzish de889c93b8
fix: magnet data invalidation of tracker IDs (#5957) 2023-09-03 20:40:52 -05:00
Yat Ho 48dcff975a
fix: workaround HSTS upgrading to HTTPS for HTTP trackers (#5969) 2023-09-03 18:26:39 -05:00
Charles Kerr 14b324fc9c
fix: transmission-remote -l regression (#5960) 2023-09-01 17:23:44 -05:00
Yat Ho e39045cf69
refactor: tidy up announcer code (#5945) 2023-09-01 16:51:58 -05:00
Charles Kerr fc4b7ed9f4
refactor: prefer functions return std::string instead of tr_strbuf (#5949) 2023-08-29 21:58:31 -05:00
Charles Kerr 43030132fc
refactor: use std::variant in tr_variant (#5936) 2023-08-23 12:57: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 59c638c63d
refactor: replace tr_variant::is_*() with tr_variant::holds_alternative() (#5930) 2023-08-21 16:16:54 -05:00
Charles Kerr 5837603b6f
refactor: make tr_variant follow RAII (#5923) 2023-08-20 23:15:23 -05:00
Yat Ho bb386cf17f
refactor: use one socket for sending and receiving lpd announces (#5909) 2023-08-18 15:56:28 -05:00
Yat Ho eea7d4d886
refactor: re-organise `net.h` member functions (#5878) 2023-08-17 22:13:01 -05:00
Charles Kerr a4d205612a
refactor: add tr_variant_serde (#5903) 2023-08-17 11:02:45 -05:00
fredo-47 9df4adf9b6
chore: change some log-levels in global-ip-cache.cc from info to debug (#5870) 2023-08-15 13:47:20 -05:00
tearfur 449549c84f
fix: do not mark peer as not connectable when we are currently connected (#5889) 2023-08-14 16:46:09 -05:00
tearfur a88b353576
chore: rename other publicAddress() functions (#5873) 2023-08-14 10:31:12 -05:00
tearfur 0c7992baa2
fix: cover all pex disabled cases in `get_peer_candidate()` (#5806) 2023-08-14 09:56:43 -05:00
tearfur 72f604dbf8
fixup! perf: improve sorting performance in `tr_peerMgrGetPeers()` (#5807) 2023-08-13 22:02:11 -05:00
Zhenyu Qi 8873f2a50c
fix: announce with query replace bug (#5871) 2023-08-13 19:27:55 -05:00
tearfur 27f3a5b82a
fix: announce LDP on listening interface (#5875)
* fix: make sure LDP announces are sent on the listening interface

* fix: add implementation for test mediator

* fix: set SO_REUSEADDR for send socket
2023-08-13 12:04:04 -05:00
tearfur badeed374f
fix: incorrect pex flags merge logic (#5876) 2023-08-05 12:37:33 -05:00
tearfur a2849219f7
feat: split connectable and non-connectable pool (#5801) 2023-08-01 09:56:26 -05:00
Mike Gelfand c14094f4c9
Use clang-format for qualifier alignment (#5845)
`QualifierAlignment` option is available since clang-format v14 and
works better than our own script.
2023-07-30 16:43:43 +01:00
Cœur 84f9d01e7d
fix: -fobjc-arc with GCC (#5632) 2023-07-29 20:57:43 -05:00
tearfur 8b4d05d4e5
fixup! refactor: `tr_torrent.incompleteMetadata` from raw pointer to `std::optional` (#5837) 2023-07-29 08:49:52 -05:00
Charles Kerr c6e47c232e
refactor: use std::variant in tr_variant, pt 1: make tr_variant_string private (#5832) 2023-07-28 16:14:31 -05:00
tearfur d2fabc737b
fix: disregard locale when building LDP announce message (#5825) 2023-07-28 10:31:11 -05:00
Charles Kerr ed3f6c2ec8
fixup! perf: use small::max_size_vector in tr_torrentGetMetadataPiece (#5830)
* fixup! perf: use small::max_size_vector in tr_torrentGetMetadataPiece() (#5768)

* enable tests for alpine CI

---------

Co-authored-by: tearfur <46261767+tearfur@users.noreply.github.com>
2023-07-28 09:53:10 -05:00
tearfur 22da17f13f
fix: clamp down harder for upload as well (#5821) 2023-07-25 11:53:33 -05:00
tearfur f758cb3597
refactor: avoid code duplication (#5793) 2023-07-17 08:56:57 -05:00
Charles Kerr ea9fd64830
refactor: tr_compare_3way() (#5799) 2023-07-15 21:55:44 -05:00
Charles Kerr 273f943a3b
refactor: make a few more methods `constexpr` (#5798) 2023-07-15 19:02:39 -05:00
tearfur 31f2c7aa29
refactor: `tr_torrent.incompleteMetadata` from raw pointer to `std::optional` (#5791) 2023-07-15 15:38:38 -05:00
tearfur 01f25b030c
perf: improve sorting performance in `tr_peerMgrGetPeers()` (#5792) 2023-07-15 08:18:37 -05:00
Charles Kerr 32af004248
perf: reuse the vector in receonnectPulse(). (#5788) 2023-07-14 17:46:10 -05:00
tearfur ca4cb1a675
fix/cleanups to tr_peerMsgsImpl (#5783)
* fix: correct condition to advertise pex support in ltep handshake

1. Advertise pex support regardless of whether the peer had advertised pex support. No reason to give up an opportunity to advertise pex support just because our direct peer does not support it.
2. Check if pex is enabled in global settings as well.
2023-07-14 10:51:52 -05:00
Charles Kerr c867f00153
refactor: replace `peer_atom` with `tr_peer_info` (#5773) 2023-07-14 07:06:25 -05:00
tearfur 2ec19e694d
chore: minor code cleanup (#5760) 2023-07-13 09:10:43 -05:00
Charles Kerr a9a6e54858
refactor: make tr_socket_address a class (#5772) 2023-07-12 17:29:47 -05:00
Charles Kerr bc562eb9a5
perf: avoid atom lookup in tr_peerMgrSetUtpSupported() (#5766) 2023-07-12 10:10:20 -05:00
tearfur 0350b62248
refactor: remove redundant seed limit check (#5770) 2023-07-12 08:27:06 -05:00
Charles Kerr f036b7c3bf
perf: use small::max_size_vector in tr_torrentGetMetadataPiece() (#5768) 2023-07-12 07:36:16 -05:00
tearfur 8d0788dd9e
fix: incorret log message in `global-ip-cache.cc` (#5769) 2023-07-11 22:16:46 -05:00
tearfur 78367c098f
perf: use `std::unordered_map` for `tr_swarm.pool` and Handshakes (#5740) 2023-07-11 11:57:29 -05:00
Charles Kerr 8169d524ea
feat: do not auto-disconnect when a known seed initiates a connection and we are seeding (#5756) 2023-07-08 14:27:31 -05:00
tearfur 8e822a3cbb
perf: avoid copying/moving elements in peer candidate list (#5755) 2023-07-08 13:09:34 -05:00
tearfur 5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
Charles Kerr 82f08420fd
fix: crash regression in tr_peerMgr::make_new_peer_connections() 2023-07-08 09:32:20 -05:00
Charles Kerr ec54e7f11e
fixup! refactor: remove libtransmission::Buffer (#5676) (#5748) 2023-07-08 02:25:57 -05:00
tearfur 97da2adbca
fix: spelling mistake in `net.h` function call (#5739) 2023-07-07 20:13:02 -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 685e245f4a
perf: faster get peer candidates (#5734) 2023-07-05 23:16:18 -05:00
tearfur 2211086338
fix: conform to libcurl requirements to avoid memory leak (#5702) 2023-07-05 22:05:03 -05:00
Charles Kerr f83a60830a
refactor: add tr_socket_address typedef (#5730) 2023-07-05 11:33:50 -05:00
tearfur 6482d78852
perf: reduce copying in `enforceSwarmPeerLimit()` (#5731)
* reduce copying in `enforceSwarmPeerLimit()`

* clearer comparator naming
2023-07-05 10:10:04 -05:00
tearfur 2a9c30a616
add constexpr noexcept (#5729) 2023-07-04 23:50:39 -05:00
tearfur 8543555584
refactor: use `std::pair` to store socket addresses (#5723) 2023-07-04 20:29:12 -05:00
Charles Kerr 5b38e819da
perf: minor cleanups (#5728)
* refactor: in torrent_metainfo.is_private(), cheaper to return a bool than a bool const&

* refactor: in tr_torrent::id(), cheaper to return an int than an int const&

* refactor: in tr_metainfo_builder.is_private(), cheaper to return a bool than a bool const&

* refactor: break peer_atom.flags2 into separate bools
2023-07-04 19:47:51 -05:00
tearfur 449da2b53e
fix: assert failure when Transmission quit with pending IP queries (#5721) 2023-07-04 16:33:58 -05:00
Charles Kerr 56b27057fd
refactor: add lightweight observable / observer for decoupling (#5716) 2023-07-04 15:47:18 -05:00
Charles Kerr 6a2a4c3032
perf: move log strings instead of cloning them (#5726) 2023-07-04 14:03:45 -05:00
Charles Kerr 0a6d1806f9
perf: avoid string allocations by using fixed-width hash strings (#5725) 2023-07-04 13:04:03 -05:00
Charles Kerr e68b76bc14
perf: use small::unordered_map in tr_torrent::primary_mime_type() (#5722) 2023-07-04 09:40:36 -05:00
Charles Kerr 7c7771a12b
perf: use small:set in tr_file_piece_map::reset() (#5720) 2023-07-03 21:57:09 -05:00
Charles Kerr d76d26a580
perf: faster Cache::write_contiguous() (#5715) 2023-07-02 15:23:32 -05:00
Charles Kerr d2d30c2734
chore: update mime types (#5712) 2023-07-02 08:32:21 -05:00
Charles Kerr 4c282bdbb4
fix: recent build warnings and errors (#5711)
* fix: use std::empty instead of isEmpty()

* fix: fix trivially assignable warning hicpp-move-const-arg

* fix: fix clang-diagnostic-unused-but-set-variable warning

* fix: fix readability-braces-around-statements warning
2023-07-01 10:22:15 -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
Charles Kerr cb101ec6cf
refactor: make tr_logGetQueueEnabled() private (#5693)
it is only used in log.cc, so remove it from the public header
2023-06-29 14:19:40 -05:00
tearfur b79de0b431
perf: convert comparator functors to static constexpr (#5687) 2023-06-29 13:13:25 -05:00
Charles Kerr 2f2ae61d0c
refactor: remove unused function tr_peer.bandwidth() (#5691) 2023-06-29 11:14:05 -05:00
Charles Kerr 22bb9e5757
refactor: rename tr_dirSpace() to tr_sys_path_capacity() (#5689) 2023-06-29 10:23:00 -05:00
Charles Kerr 3474a1da58
chore: remove tr_wait(); use std::this_thread::sleep_for() (#5683) 2023-06-29 08:51:39 -05:00
Charles Kerr fd4a0b1d16
chore: remove unused function tr_env_get_int() (#5682) 2023-06-28 22:04:07 -05:00
Charles Kerr 7e1ecf2f0f
refactor: remove useless TR_DEBUG_FD env var (#5681)
This feature was originally meant to redirect verbose logging to *any*
fd, but it now only supports writing to stdout or stderr, and defaults
to stderr.

Redirecting to stdout isn't very useful and complicates the code, so
just remove it and always use stderr.
2023-06-28 16:26:15 -05:00
tearfur 7fa1498ed5
perf: make `CompareCacheBlockByKey` constexpr (#5678) 2023-06-28 10:23:38 -05:00
tearfur 6bbe6537cb
feat: bypass disk write cache when `cache-size-mb` is zero 2023-06-28 08:57:26 -05:00
Charles Kerr 9afced725a
refactor: remove libtransmission::Buffer (#5676)
* refactor: use StackBuffer in announcer-udp

* chore: update buffer tests

* refactor: remove unused libtransmission::Buffer

superseded by libtransmission::StackBuffer
2023-06-27 19:06:25 -05:00
Geoffrey Bonneville 7fdfabe184
fix: do not write log if file handler is bad (#5675) 2023-06-27 13:44:10 -05:00
Charles Kerr 2db2091599
perf: in cache, flush biggest contiguous blocks (#5671) 2023-06-27 12:08:29 -05:00
Charles Kerr 24bc3d135d
perf: add StackBuffer using small::vector (#5672)
* perf: use libtransmission::StackBuffer in variant-benc

* perf: use libtransmission::StackBuffer in variant-json

* perf: use libtransmission::StackBuffer in handshake

* perf: use libtransmission::StackBuffer in peer-msgs

* perf: use libtransmission::StackBuffer in peer-io
2023-06-27 10:51:20 -05:00
tearfur 70decc1d9d
perf: improve IPv4 `tr_address` comparison (#5651) 2023-06-26 21:17:32 -05:00
tearfur ed02f98014
ditch `std::lldiv` so that functions can take matching parameter types (#5659)
* ditch `std::lldiv` so that functions can take matching parameter types

* revert unintended change
2023-06-25 13:29:58 -05:00
Charles Kerr dc88b97f37
refactor: small again (#5666)
* refactor: restore the non-small parts of 5654

* refactor: restore the peer-mgr-active-requests parts of 5654

* chore: iwyu evbuffer in web.h
2023-06-25 12:33:32 -05:00
tearfur aa6f00b162
refactor: global-ip-cache.cc nits (#5655) 2023-06-24 14:30:37 -05:00
LaserEyess 9b5a75528e
fix: broken unix socket support (#5665)
The changes in #5523 made two errors in the new implementation

1. tr_unix_address::to_string() got the ternary check backwards, leading
   to always printing an empty string when the address is valid.
2. The inputs to tr_strvStartsWith in tr_unix_address::from_string()
   were backwards as well, leading to the check failing for valid
   socket addresses.

Co-authored-by: LaserEyess <LaserEyess@users.noreply.github.com>
2023-06-24 13:57:20 -05:00
Charles Kerr df1adf0e0f
chore: revert small buffer (#5654)
* Revert "perf: use libsmall in libtransmission, pt 3 (#5653)"

This reverts commit 3b03494580.

* Revert "perf: use small in libtransmission (#5650)"

This reverts commit 559f6f0332.
2023-06-22 18:42:48 -05:00
tearfur 41cfdce6fd
refactor: replace some C idioms with C++ ones (#5656)
* tidy up legecy practices

* remove undefined std::ignore usage

* avoid extra function stack level in daemon.cc
2023-06-22 17:58:16 -05:00
tearfur 699b3d8416
perf: use a std::map to store peers in `tr_swarm` (#5645) 2023-06-22 15:21:44 -05:00
tearfur b562b2de4b
feat: new default piece size calculation for transmission-create (#5615) 2023-06-22 11:50:57 -05:00
Charles Kerr 3b03494580
perf: use libsmall in libtransmission, pt 3 (#5653)
* refactor: use BufferReader, BufferWriter in peer-socket

* feat: expose GrowthFactor in tr-buffer

* perf: choose better defaults for the peer message buffers

* chore: sync tests

* refactor: use small::map in ActiveRequests::Impl
2023-06-22 00:24:42 -05:00
Charles Kerr 559f6f0332
perf: use small in libtransmission (#5650)
* refactor: reimplement Buffer using small

* refactor: use SmallBuffer in announcer-udp

* refactor: use SmallBuffer in variant-json

* refactor: use SmallBuffer in variant-benc

* refactor: use SmallBuffer in handshake

* refactor: use SmallBuffer in peer-msgs

* refactor: delete move semantics on stack-based buffers
2023-06-21 22:41:09 -05:00
tearfur 40e80989b2
encode `&key=` as fixed-width 8-digit hex (#5652) 2023-06-21 11:53:06 -05:00
Charles Kerr 432fc9bafc
refactor: add libsmall dependency (#5649)
* refactor: add small dependency

* refactor: use small in variant.cc

* refactor: use small in cache.h
2023-06-20 22:50:36 -05:00
tearfur 548f840b8d
fixup: refactor handshake objects to use socket address as key as well (#5644) 2023-06-20 13:10:26 -05:00
tearfur 280dea4e33
add support for sending the `ipv4` parameter during ltep handshake (#5643) 2023-06-20 10:51:07 -05:00
tearfur 64261685d8
fix: use both address + port together as a key for peer lookup (#5619) 2023-06-19 20:26:39 -05:00
LaserEyess 23a52fa1c5
fixup: dedup tr_rpc_address with tr_address (#5523)
* fixup: dedup tr_rpc_address with tr_address

tr_rpc_address was duplicating a lot of work that tr_address was doing a
lot better. Fall back to using tr_address for ipv4/ipv6 connections and
make a tr_unix_addr for handling unix sockets.

* remove unnecessary functions
2023-06-19 15:51:20 -05:00
Василий Чай ddac05954b
fix: return error when renaming into existing file (#5563) 2023-06-19 00:30:55 -05:00
tearfur b8ff35c4ce
handle IPv6 NAT during LTEP handshake (#5565)
* fix: peer handshake reported wrong ipv6 address

https://github.com/transmission/transmission/issues/5542#issuecomment-1556710922
2023-06-18 19:06:31 -05:00
Charles Kerr fd583ac878
deps: bump libfmt to v10.0.0 (#5635)
seems to be semver/minor safe for our API use

Fixes #5511.

Possibly fixes #5627.
2023-06-18 17:36:39 -05:00
tearfur 802619e174
fix: fixes and improvements to global IP query (#5510) 2023-06-11 18:27:01 -05:00
Charles Kerr c8e84f870b
ci: remove "brew update" step (#5606) 2023-06-11 16:28:43 -05:00
Mike Gelfand 8ca02b8f28
Avoid locale use in `tr_truncd()` (#5587)
`tr_parseNum<>()` is implemented with `fast_float::from_chars()`, and
the latter is documented as "expecting a locale-indepent format
equivalent to what is used by std::strtod in the default ("C") locale".
To accomodate locale independent number parsing, switch back to
locale-independent number formatting in `tr_truncd()` by both removing a
`L` format specifier from `fmt::format_to_n()` call and using a fixed
"." decimal separator when truncating the value.
2023-06-10 17:09:18 -05:00
Daniel Kamil Kozar c1c27f3da0
Expose files' begin and end pieces via RPC (#5578)
* Expose files' begin and end pieces via RPC

This adds two arguments, `beginPiece` and `endPiece`, for each of the entries
in the `files` array of the RPC's `torrent-`get` method.

The point is to allow RPC clients to display a file's completion progress as
piece-based in addition to byte-based.
2023-06-05 13:15:32 -05:00
Cœur 87472672a6
build: fix xcode build (#5521) 2023-05-19 23:17:24 -05:00
Charles Kerr e171cbae9c
refactor: move Buffer::add_socket() to BufferWriter::add_socket() (#5543) 2023-05-19 23:06:26 -05:00
Charles Kerr ae888ef08e
perf: avoid map insertion for complete blocks received (#5540) 2023-05-19 18:36:07 -05:00
Charles Kerr 52b03c2489
refactor: migrate methods to buffer reader (#5533) 2023-05-18 16:56:29 -05:00