Commit Graph

3360 Commits

Author SHA1 Message Date
Matt Joiner 54665f160a
Rework peer connection writer to keep individual writes smaller
This fixes an issue with WebRTC when the write buffers get too big.
2022-06-14 16:01:47 +10:00
Matt Joiner caf35cd9b8
internal/testutil.Info: Support multi-file Torrents 2022-06-14 16:01:47 +10:00
Matt Joiner 65896d4cec
ExportStatusWriter: take testing.TB instead of *testing.T 2022-06-14 16:01:47 +10:00
Alex Sharov 061407fbc4
github.com/edsrzf/mmap-go v1.1.0 2022-06-14 15:57:08 +10:00
Matt Joiner 8ccacbfd17
Revert "Switch requestState to be a slice"
This reverts commit 9eb80abc29.

Via email I received a report of excessive memory use: Memory use with a slice is proportional to the total size of all torrents loaded into the Client, which can be very large.
2022-06-01 18:24:50 +10:00
Matt Joiner f21aeed90e
Demote webrtc conn error logging level to debug
Fixes #716.
2022-06-01 18:18:37 +10:00
Nathanael Demacon ed1fe91dd2
Implement a public `Peer.DownloadRate` (#750) 2022-05-23 10:42:51 +10:00
Matt Joiner eeb021b134
Use Option for cached Torrent length
Fixes https://github.com/anacrolix/torrent/issues/630.
2022-05-12 13:47:12 +10:00
Matt Joiner 9434fe58a2
Set debug log level for outgoing connection error
Contributed by @tsynik in https://github.com/anacrolix/torrent/issues/702#issuecomment-1010523079.
2022-05-12 13:33:57 +10:00
Matt Joiner 39bd8fc5a0
Use reusable roaring iterators 2022-05-12 10:42:16 +10:00
Matt Joiner 0235dd3801
Add fallback piece ordering for non-readahead priorities 2022-05-12 10:37:50 +10:00
Matt Joiner 9f9b02e3dd
cmd/torrent: Respect default client max unverified bytes 2022-05-12 10:37:36 +10:00
Matt Joiner 669c69faac
Disable update requests timer 2022-05-12 10:37:36 +10:00
Matt Joiner 590d1ac265
Make piece states a slice and reuse it and request indexes between runs 2022-05-12 10:37:36 +10:00
Matt Joiner 4eb6a49f27
Use intermediate t in Peer.getDesiredRequestState 2022-05-12 10:37:36 +10:00
Matt Joiner 9eb80abc29
Switch requestState to be a slice 2022-05-12 10:34:28 +10:00
Matt Joiner f235c8ea51
Reuse piece order state for request ordering 2022-05-12 10:34:28 +10:00
Matt Joiner 88a867ef9c
Default 64 MiB max unverified bytes 2022-05-12 10:34:28 +10:00
Matt Joiner eb7811f909
Cache chunksPerRegularPiece 2022-05-12 10:34:26 +10:00
Matt Joiner 7d4f64ce3c
Combine pending and last requested 2022-05-11 11:33:11 +10:00
Matt Joiner 5fe7007d34
Update ajwerner/btree 2022-05-09 12:53:47 +10:00
Matt Joiner 660d73eb9c
cmd/torrent: Improve context error handling 2022-05-09 12:51:02 +10:00
Matt Joiner 23a0e7f7d3
Remove redundant type conversions 2022-05-09 12:51:02 +10:00
Matt Joiner daff06cf20
Move undirtiedChunksIter into its own file 2022-05-09 12:51:01 +10:00
Matt Joiner e90037216c
Use a generic heap implementation for request selection 2022-05-09 12:05:50 +10:00
Matt Joiner 7e362c0cb3
Order readahead requests by piece index 2022-05-09 12:05:50 +10:00
Matt Joiner a54d2d81e4
Retain peer local request ordering 2022-05-09 12:05:50 +10:00
Matt Joiner 9a9c7dee00
Add and use typed roaring bitmap 2022-05-09 12:05:50 +10:00
Matt Joiner d5d940e643
cmd/torrent download: Fix waiting for pieces when some are already complete 2022-05-09 12:05:12 +10:00
Matt Joiner 78c36e4c2f
Add Torrent.pieceIndexOfRequestIndex 2022-05-09 12:05:12 +10:00
Matt Joiner 9b9a37eee6
Add a test for allocations in undirtiedChunksIter.Iter 2022-05-09 12:05:12 +10:00
Alex Sharov 3a3307632a
Infer pp.Decoder.MaxLength from chunk size (#743) 2022-05-08 11:36:43 +10:00
Matt Joiner 1f6b23d995
cmd/torrent: Export Prometheus metrics 2022-04-28 09:45:49 +10:00
afjoseph 5bcd5d1b13
[client] Handle nil IP in badPeerAddr() 2022-04-26 10:59:12 +10:00
Matt Joiner a3a5a81e84
Support custom path escaping for WebSeeds 2022-04-26 10:57:40 +10:00
Matt Joiner d2d8125eea
WebSeed PathEscaper API tweaks 2022-04-26 10:46:01 +10:00
FIGBERT 2c8a3219db
Use Torrent logger instead of default logger (#740) 2022-04-25 18:49:59 +10:00
afjoseph a79c3bd5d3 fixup! [webseed] Add a custom URL encoder for webseeds 2022-04-22 04:23:43 +02:00
afjoseph 02cc723750 [webseed] Add a custom URL encoder for webseeds 2022-04-21 16:21:29 +02:00
FIGBERT 529d97b5eb
Use PeerConn logger instead of default logger (#736) 2022-04-14 19:02:45 +10:00
Matt Joiner d8611ecf2d
Fix races around Reader and Torrent.Drop when Torrent is closed 2022-04-11 15:44:24 +10:00
Matt Joiner 7671a55a5c
Merge branch 'supress_webrtc_logs' 2022-04-11 14:53:35 +10:00
Matt Joiner 67df8f8cdb
Fix webrtc logging for JS build 2022-04-11 14:53:02 +10:00
Jonathan McDowell a1a820d3c9
Avoid heap allocation in GetRequestablePieces (#734)
The calculation of whether we should ignore a piece in
GetRequestablePieces ends up doing an allocation for every piece, when
all we really need to do is query the index in the torrent. Provide an
IgnorePiece function instead, which avoids the need for a temporary
allocation.

Observed to cut out 40% of object allocations in some workloads (large
download, lots of seeds).
2022-04-11 14:22:05 +10:00
Matt Joiner cba434999a
cmd/torrent: Fix panic with IPv6 public IP 2022-04-11 14:00:06 +10:00
alex.sharov fc3faca117 discard logger factory 2022-04-09 14:06:05 +07:00
Matt Joiner d0dd0a4057
Update anacrolix/envpprof 2022-04-08 14:12:23 +10:00
Matt Joiner a22150ab61
Ensure unlock occurs on panic in reader 2022-03-31 17:04:36 +11:00
Matt Joiner dd1ca6f514
Use Info.BestName in a few more places 2022-03-18 09:15:50 +11:00
Matt Joiner aa4a831c78
Rearrange transfer tests so build directives are applied by the right packages 2022-03-17 16:08:00 +11:00