2
0
mirror of synced 2025-02-24 14:48:27 +00:00

559 Commits

Author SHA1 Message Date
afjoseph
2a6152b832 [trackerscraper] Add custom DNS lookup function 2021-11-01 11:26:58 +11:00
Matt Joiner
98957b6e8e Only assert pending requests when check is enabled
Uses too much CPU for production from its current callsites.
2021-10-26 14:42:42 +11:00
Matt Joiner
37373864e4 Add more comprehensive pending requests assertions 2021-10-25 16:16:56 +11:00
Matt Joiner
d331419604 Demote Torrent.runHandshookConnLoggingErr level to debug 2021-10-21 11:40:06 +11:00
Matt Joiner
ff3c186396 Add low requests check
This is an optimization for webseeds, which have 10 synchronous request routines, and if the request count dips below 10, some sit idle. There is probably something similar to be done with PeerConns, which won't update until there are zero requests, but there there is a timer to refresh updates, and the queues are very long (typically 512-2048).
2021-10-21 10:48:43 +11:00
Matt Joiner
8eec0b665e Update webseeds for peer requesting 2021-10-21 10:28:57 +11:00
Matt Joiner
a7d3296003 Use roaring.Bitmap.IsEmpty where appropriate 2021-10-19 14:08:56 +11:00
Matt Joiner
de87fd3eb1 Avoid allocation putting undirtiedChunksIter into interface 2021-10-19 14:08:56 +11:00
Matt Joiner
529aaa9b1f Use roaring bitmap for pending pieces
Also makes a significant optimization for peerHasWantedPieces possible.
2021-10-19 14:08:56 +11:00
Matt Joiner
5e8f61abb5 Optimize request updates due to conn and reader state changes 2021-10-19 14:08:56 +11:00
Matt Joiner
7d0be0ac65 Optimize chunk calculations in request strategy 2021-10-19 14:08:56 +11:00
Matt Joiner
10b9e88356 Implement pending requests using BSI 2021-10-19 14:08:56 +11:00
Matt Joiner
9aff9f3592 Extract pendingRequests 2021-10-19 14:08:56 +11:00
Matt Joiner
2be5a95b06 Add reasons for updateRequests to be triggered 2021-10-19 14:08:56 +11:00
Matt Joiner
16c571b58b Add pprof labels for request updates and remove Client-wide requester 2021-10-19 14:08:13 +11:00
Matt Joiner
30b99e7102 Remove peer piece inclination and piece request order
These are vestigial data structures used with old request strategy implementations.
2021-10-19 14:08:13 +11:00
Matt Joiner
3ef8cfba27 Log handshook conn run errors with level warning
(cherry picked from commit 7ca7890e9f30307a1f4942e6d987791a142c3cb3)
2021-10-19 14:07:48 +11:00
Matt Joiner
6f196c8d33 Update piece priority after processing piece hash result
Seems to avoid some silly performance issues in triggering request updates due to a piece still pending while being marked.
2021-10-19 14:03:03 +11:00
Simon Kirsten
637045c19a
Add DisableInitialPieceCheck option (#677) 2021-10-11 11:33:40 +11:00
Matt Joiner
72a06d88fc Add TorrentStats.PiecesComplete
Fixes https://github.com/anacrolix/torrent/issues/352.
2021-10-07 13:50:13 +11:00
Matt Joiner
28e9064288 Fix comment that seems to mess with GoLand's package structure 2021-10-07 12:09:52 +11:00
Matt Joiner
c9c137d8f2 Add a flag for Complete 2021-10-07 12:09:20 +11:00
Matt Joiner
9720fd576d Update chansync 2021-10-07 11:45:09 +11:00
Matt Joiner
da1221dd50 Change Peer._peerPieces to use raw roaring Bitmap type
The wrapper type was from when roaring didn't support zero-alloc initialization.
2021-10-05 17:48:34 +11:00
YenForYang
86fe6cc872
Inlineable (*Torrent).BytesMissing() (#633)
Honestly a name like `BytesLeft` would have been more suitable, but it's too late for that I guess.
2021-09-27 12:43:09 +10:00
Matt Joiner
63b3d2d211 Track dirty chunks in a single bitmap on Torrent 2021-09-20 18:52:54 +10:00
Matt Joiner
510877ea43 Reduce the diff to master and add peerRequesting feature const 2021-09-20 15:09:28 +10:00
Matt Joiner
1d2d1a9cde Store peer requests in a bitmap 2021-09-19 15:16:37 +10:00
YenForYang
e80b989f8e
Clarify maximum value of "metadata_size" (#609) 2021-09-14 22:36:19 +10:00
YenForYang
a8db640c62
Drop bradfitz/iter dependency (#605)
* Drop bradfitz/iter dependency

`range iter.N` looks nice and doesn't allocate, but unfortunately using a `range` expression blocks a function from being inlined wherever it's used (for now). It's not that we need inlining in all cases, but I do think a C-style for loop looks just as nice and is probably clearer to the majority. There also aren't any clear disadvantages to changing (unless you just happen to dislike the look of C)

* Update misc_test.go

* Update rlreader_test.go

* Update torrent_test.go

* Update bench_test.go

* Update client_test.go

* Update iplist_test.go

* Update mse_test.go

* Update peerconn_test.go

* Update peerconn.go

* Update order_test.go

* Update decoder_test.go

* Update main.go

* Update bench-piece-mark-complete.go

* Update main.go

* Update torrent.go

* Update iplist_test.go

* Update main.go
2021-09-14 13:46:50 +10:00
YenForYang
5c440e8929
Simplify (*Torrent).gotMetainfo (#581) 2021-09-13 11:41:11 +10:00
Matt Joiner
0d10a1b53a Optimize Torrent.worstBadConn 2021-09-10 23:07:10 +10:00
YenForYang
62c6fbc8f8
Clarify ownership of (*Torrent).chunkPool (#583)
Basically bind the lifetime of chunkPool to the torrent by using `sync.Pool` in lieu of `*sync.Pool`. Gives the GC ever so slightly less work to do.
2021-09-09 22:27:16 +10:00
Zilog8
ccb90f1252
Improve Closing (#559)
- Prevent double-closing in cmd/torrent
- Move async closing from storage to torrents, and wait on them to finish tidying up before returning/exiting.
2021-09-05 11:33:41 +10:00
Matt Joiner
175b826e73 Rework Reader waiting 2021-09-04 23:07:32 +10:00
Matt Joiner
bf6e64a652 Fix some DeepSource lints 2021-08-30 11:48:34 +10:00
Matt Joiner
72c74f7800 Remove unused code 2021-08-19 16:06:46 +10:00
Bora M. Alper
16176b762e
Add linter CI (#542)
* Add linter CI

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make gosec CI ignore SHA1 and upload sarif

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Fix formatting of source files

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make go vet ignore unkeyed composite literals and fix other warnings

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make staticcheck ignore unused methods and fix other warnings

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Use golangci-lint

Signed-off-by: Bora M. Alper <bora@boramalper.org>
2021-08-16 11:11:31 +10:00
Matt Joiner
22c5a94a6a Use roaring.Bitmap directly for completed pieces
Looking at improving the performance around this per https://github.com/anacrolix/torrent/discussions/547#discussion-3522317.
2021-08-16 11:07:10 +10:00
Matt Joiner
1d53c170b0 Close torrent storage asynchronously on drop 2021-07-17 19:10:07 +10:00
Matt Joiner
5eab39001f Add debug level to piece hash failure log message 2021-07-17 18:52:41 +10:00
Matt Joiner
c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner
15f8e77519 Add explicit metadata extension types 2021-06-21 12:14:06 +10:00
Matt Joiner
af1ca91e04 Remove conntrack, expose Torrent.AnnounceToDht, ClientConfig.PeriodicallyAnnounceTorrentsToDht 2021-06-21 12:13:53 +10:00
Matt Joiner
ebd19af795 Merge branch 'request-strategy-rewrite' 2021-06-21 12:04:06 +10:00
Zilog8
e2a559e243
Allow Storage Backends to do their own Hashing (#518)
* Allow Storage Backends to do their own Hashing

- Describes an optional interface 'SelfHashing' that a storage backend's type implementing 'PieceImpl' may also implement in order to calculate piece hashsums itself.

- Alters the 'hashPiece' function in the torrent package to look for types implementing 'SelfHashing' . If not implemented, calculate the hash as usual.
2021-06-08 15:45:35 +10:00
Matt Joiner
47c49735fc Fix race in piece availability runs 2021-06-07 13:01:40 +10:00
Matt Joiner
b43987fcc8 Fix up some crashes around piece availability 2021-06-07 13:01:40 +10:00
Matt Joiner
95d808d3c5 Use rejiggered missinggo bitmap 2021-06-07 13:01:39 +10:00
Matt Joiner
42bf6b58a6 Fix in decPieceAvailability when we don't have torrent info
Happens when we close a Peer before getting Torrent info.
2021-06-07 13:01:39 +10:00