Commit Graph

201 Commits

Author SHA1 Message Date
Charles Kerr
a575be778f refactor: Values pt. 2 - use Speed in tr_bandwidth (#6234) 2023-11-10 17:12:24 -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
Yat Ho
d224985ef8 fixup! perf: cut down excess copying when downloading (#5907) (#6169) 2023-10-27 00:19:24 -04:00
Yat Ho
6e7fdef721 perf: cut down excess copying when downloading (#5907)
* refactor: directly copy from socket to incoming payload

* refactor: directly process the incoming field

There is no need to copy the payload to a new buffer before processing.

`process_peer_message()` isn't going to return until it's done, and nothing else is going to mess with the incoming field while inside `process_peer_message()`.

* refactor: remove while loop

* add assert
2023-10-25 09:51:36 -04:00
Charles Kerr
bbc3ce039f refactor: remove quark support from tr_variant (#6159) 2023-10-24 14:49:23 -04:00
Charles Kerr
db96771c80 refactor: add tr_torrent::Error helper class (#6077) 2023-10-08 21:33:34 -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
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
tearfur
a2849219f7 feat: split connectable and non-connectable pool (#5801) 2023-08-01 09:56:26 -05:00
tearfur
f758cb3597 refactor: avoid code duplication (#5793) 2023-07-17 08:56:57 -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
Charles Kerr
bc562eb9a5 perf: avoid atom lookup in tr_peerMgrSetUtpSupported() (#5766) 2023-07-12 10:10:20 -05:00
Charles Kerr
f036b7c3bf perf: use small::max_size_vector in tr_torrentGetMetadataPiece() (#5768) 2023-07-12 07:36:16 -05:00
tearfur
5ec4ca550e chore: iwyu (#5746) 2023-07-08 10:24:03 -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
Charles Kerr
2f2ae61d0c refactor: remove unused function tr_peer.bandwidth() (#5691) 2023-06-29 11:14:05 -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
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
699b3d8416 perf: use a std::map to store peers in tr_swarm (#5645) 2023-06-22 15:21:44 -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
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
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
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
Charles Kerr
b9698210ef refactor: restore part of Buffer::reserve_space() (#5529) 2023-05-16 21:46:41 -05:00
Charles Kerr
2cf9678737 fix: revert buffer reserve space (#5528)
* Revert "refactor: use BufferReader, BufferWriter as function args (#5518)"

This reverts commit c2d48a7d11.

* Revert "fixup! refactor: add BufferReader, BufferWriter::reserve_space() (#5513)"

This reverts commit b08e17beef.

* Revert "refactor: add BufferReader, BufferWriter::reserve_space() (#5513)"

This reverts commit 51fd7056ba.
2023-05-14 17:24:42 -05:00
Charles Kerr
8a1a6dba49 perf: avoid extra heap alloc in block cache (#5522) 2023-05-13 14:16:00 -05:00
Charles Kerr
7cabeff24f perf: use std::bitset instead of tr_bitfield in incoming_piece_data (#5519)
Since max size is small and known at compile time, we can avoid extra heap allocations
2023-05-12 19:31:59 -05:00
Charles Kerr
c2d48a7d11 refactor: use BufferReader, BufferWriter as function args (#5518) 2023-05-12 18:10:08 -05:00
Charles Kerr
51fd7056ba refactor: add BufferReader, BufferWriter::reserve_space() (#5513) 2023-05-12 11:15:15 -05:00
Charles Kerr
0d3b321bac refactor: use snake_case for libtransmission class methods (#5497) 2023-05-05 23:11:05 -05:00
Charles Kerr
9d2507c7e3 refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -05:00
Charles Kerr
ce4ffc3bdb fix: 5422 use-after-free in peerMsgs::canRead (#5425) 2023-04-20 13:18:53 -05:00
Charles Kerr
a8e01ac38d fix: minor warnings (#5409)
* chore: fix readability-qualified-auto warnings

* chore: fix clang-analyzer-core.uninitialized.Branch warning

* fix: collision of key 'ERROR' in transmission-qt

* chore: silence -Wshadow warning

* chore: silence warning C4100: 'iter': unreferenced formal parameter

* chore: fix warning C4127: conditional expression is constant warning
2023-04-17 23:11:09 -05:00
Charles Kerr
7d86d67bc7 chore: prefer fmt/core.h over fmt/format.h (#5404) 2023-04-16 15:34:19 -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
e91af26923 perf: remove staging step for outbound peer msgs (#5394)
Write non-piece peer messages directly to the peer's outbuf instead of
waiting for a pulse() message to refill it. This can help with latency
sending messages out.

Change the semantics of `tr_peerIo::get_write_buffer_space()`: this is
now interpreted as the preferred minimum size, rather than the maximum.
It's OK to enqueue an outgoing piece message as long as there's _some_
space left, even if the message is larger than that space.

Build peer messages with template fold expressions. This lets us move
all the message-building to a single function and add some sanity checks
to the outgoing messages.
2023-04-14 19:31:09 -05:00
Charles Kerr
d445c7f061 fix: crash in peer stats (#5279) 2023-04-14 16:03:08 -05:00
Charles Kerr
d72cb67cfb chore: include directory name in libtransmission #includes (#5308) 2023-04-14 14:33:23 -05:00
Charles Kerr
3aeefec203 chore: remove unused header includes (#5227) 2023-03-14 18:36:15 -05:00
Charles Kerr
dabd29f2b2 fix: std::clamp() assertion failure in maxAvailableReqs() (#5203) 2023-03-11 22:25:21 -06:00
Charles Kerr
47001a394e fix: 7f9ef4730 use-after-free in peerMsgs::canRead (#5152) 2023-03-05 11:50:11 -06:00
Charles Kerr
7f9ef4730e fix: assertion failure in readBtPiece() (#5097) 2023-03-03 17:43:51 -06:00
Charles Kerr
4461aa68d9 fix: handle block fragments that arrive from peers out-of-order (#4890) 2023-02-14 13:50:28 -06:00