Commit Graph

540 Commits

Author SHA1 Message Date
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
Matt Joiner fcc4ef2b95 Fix sqlite piece completion 2021-06-07 13:01:39 +10:00
Matt Joiner f19564d597 Improve piece availability status output 2021-06-07 13:01:39 +10:00
Matt Joiner 4577e8a3c1 Forgot to remove initial have all state for webseeds
Later when the webseed was closed, it was assumed that it had contributed to the piece availability count.
2021-06-07 13:01:39 +10:00
Matt Joiner 99a7cb9291 Missed piece availability code 2021-06-07 13:01:39 +10:00
Matt Joiner 2d2456249a Remove unused pieceRequestOrder in Client 2021-06-07 13:01:39 +10:00
Matt Joiner 56e2a8a3a6 Fix download rate, status output 2021-06-07 13:01:39 +10:00
Matt Joiner 5f8471e21b Rework storage.TorrentImpl to support shared capacity key 2021-06-07 13:01:39 +10:00
Matt Joiner 0830589b0a Pass tests with new full-client request strategy implementation 2021-06-07 13:01:39 +10:00
Matt Joiner f5d2ba37bc Count peers added from DHT for logging 2021-06-07 12:57:32 +10:00
Matt Joiner d7c549d2e4 Add TODOs around setting info bytes 2021-06-07 12:57:09 +10:00
Matt Joiner 47284cf426 Rename Torrent.{add,delete}Connection 2021-05-14 15:39:01 +10:00
Matt Joiner 4ab20f60b6 Improve some lock handling under panics 2021-05-14 15:36:53 +10:00
Matt Joiner 305ba51dc2 Big logging cleanup to improve experience from README 2021-05-04 12:44:51 +10:00
Matt Joiner 28f17be267 Close all peer types when Torrent closed 2021-02-19 12:58:20 +11:00
Matt Joiner 7e2c2106e6 Include webseed URLs in output of Torrent.Metainfo 2021-02-18 14:37:06 +11:00
Matt Joiner 927866e881 Limit conns per host across webseed clients 2021-02-09 19:22:38 +11:00
Matt Joiner 6bc2a2a6ac Revert "Fix stalls for responsive transfer tests"
This reverts commit d48c6ae6dc.
2021-02-03 18:55:54 +11:00
Matt Joiner d48c6ae6dc Fix stalls for responsive transfer tests
Looks like there's a timing issue between marking things complete, and already having decided to read the data from incomplete chunks.
2021-02-02 10:41:39 +11:00
Matt Joiner 60e992ec97 Rework webseed peers to use a pool of requesters
This fixes the limitation that the max outstanding requests for a webseed peer must match the request concurrency. It should mean less recalculation, and more pipelining.
2021-01-29 16:01:35 +11:00