Commit Graph

3193 Commits

Author SHA1 Message Date
Matt Joiner 4ca47eb358 Add ClientConfig.AlwaysWantConns 2021-09-21 13:04:51 +10:00
Matt Joiner c1744e37be cmd/torrent: Refactor and set progress interval to 3s 2021-09-21 10:48:16 +10:00
Matt Joiner ad70a761ec Use an iterator to skip through dirty chunks 2021-09-21 10:48:15 +10:00
Matt Joiner 40b0f9ca1e cmd/torrent: Include download stats on interrupt 2021-09-20 21:33:46 +10:00
Matt Joiner 63b3d2d211 Track dirty chunks in a single bitmap on Torrent 2021-09-20 18:52:54 +10:00
Matt Joiner 110b6f3fd3 Fix cancellation for global requesting 2021-09-20 15:24:24 +10:00
Matt Joiner 63f3e8d3de Merge branch 'master' into peer-requesting 2021-09-20 15:10:19 +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 00a7300421 cmd/torrent: Dump download statistics 2021-09-20 14:17:58 +10:00
Matt Joiner 33883c04e4 Filter next requests application for peer state changes 2021-09-20 14:16:55 +10:00
Matt Joiner a8c7516246 Add NOTES 2021-09-20 12:31:44 +10:00
Matt Joiner 1d2d1a9cde Store peer requests in a bitmap 2021-09-19 15:16:37 +10:00
Matt Joiner cd49f75cb9 When updating requests, only tickle writer if there are no requests pending
Just a quick attempt to reduce load for now. There'll be a much better way to do this.
2021-09-18 21:01:06 +10:00
Matt Joiner 21358ba458 Do peer requests separately for each peer 2021-09-18 20:34:14 +10:00
Matt Joiner d90c41c534 Add choking/allowed fast checks to Peer.shouldRequest 2021-09-18 19:00:21 +10:00
Matt Joiner cfb23e271f Export request_strategy.GetRequestablePieces 2021-09-18 18:57:50 +10:00
Matt Joiner 72eb52bb8e goimports doing its thing 2021-09-18 18:54:54 +10:00
Matt Joiner 900f36f1a9 Add some tests verifying request map ordering 2021-09-18 13:50:55 +10:00
Matt Joiner 7d8d5b0cfc Update anacrolix/args for bool Flag fix 2021-09-18 13:23:36 +10:00
Matt Joiner c6fb0535d4 requesting: Remove some obsoleted condition checks
These shouldn't be necessary since peers were pruned for the ability to allocate chunks to the current piece.
2021-09-18 12:53:22 +10:00
Matt Joiner dd52a1440f request_strategy.Peer.canRequestPiece performance: Reorder conditions 2021-09-18 12:53:22 +10:00
YenForYang 7b19e81fc6
bencode: get type of `big.Int` without creating instance (#651)
Nope, it doesn't really matter. But anyway, see c084706c22/cryptobyte/asn1.go (L267)
2021-09-18 12:44:47 +10:00
YenForYang ed3b3ee5ca
bencode: simplify getting `marshalerType` and `unmarshalerType` (#652) 2021-09-18 12:43:53 +10:00
YenForYang d43769dc15
bencode: Simplify `(*Decoder).parseListInterface()` (#656)
Preserve as much type as possible (it'll be converted to an `interface{}` anyway, but we can return `[]interface{}` instead of `{}interface` here).
2021-09-18 12:42:20 +10:00
YenForYang f3a9ea5aa9
Prevent allocation when checking interface (#649) 2021-09-18 12:36:25 +10:00
YenForYang c740cde71b
metainfo: Remove reflection dependency for `Piece.Hash()` (#661)
`copy`  will copy exactly `HashSize` bytes here.
2021-09-18 11:35:21 +10:00
YenForYang 35ad29dccc
lockWithDeferreds: inlineable Unlock() (#603) 2021-09-17 13:08:00 +10:00
Matt Joiner b757b62cf4 requesting: Filter peers that can't be allocated chunks 2021-09-16 10:47:27 +10:00
Matt Joiner aa32c94844 Rejig waits between doRequests 2021-09-16 00:12:58 +10:00
Matt Joiner a4697497aa Performance improvements in piece requesting 2021-09-16 00:12:24 +10:00
Matt Joiner 2b443d695b Change torrent capacity to not return a pointer
It's an unnecessary complication for a storage implementer.
2021-09-15 23:33:17 +10:00
Matt Joiner 72b0fee1eb Simplify PIece.iterUndirtiedChunks 2021-09-15 23:33:17 +10:00
Matt Joiner 377eabd7b4 Pre-allocate request strategy pieces 2021-09-15 23:33:17 +10:00
Matt Joiner baddf0e528 cmd/torrent: Use anacrolix/args and merge several other cmds in as subcommands 2021-09-15 10:54:14 +10:00
YenForYang ebb7160599
Inlineable `(*Torrent).Seeding()` (#626) 2021-09-15 10:28:14 +10:00
YenForYang e105d8b57a
Inlineable `(*Torrent).SetDisplayName()` (#625) 2021-09-15 10:27:52 +10:00
YenForYang 542970b961
Inlineable `(*Torrent).PieceState()` (#621) 2021-09-15 10:14:28 +10:00
YenForYang d00ba917c0
Inlineable `(*Torrent).AddPeers()` (#622) 2021-09-15 10:14:07 +10:00
YenForYang a0fe0a087d
Inlineable `DownloadPieces()` and `CancelPieces()` (#623) 2021-09-15 10:13:46 +10:00
YenForYang 29638d9e5d
Create default constructor for Client (#567)
Allow for certain values to always be properly initialized on construction -- namely the maps for now. I'm currently working on a change that requires a baseline constructor; this change would make the use of `chansync.BroadcastCond` and `chansync.SetOnce` obsolete -- i.e. one can have channel members without worrying about proper initialization/destruction of a `chan struct{}`.

As for why `makeClient` returns a value instead of a pointer: returning a value gives us more options -- you can always take a pointer from a value later on cheaply, and have things moved to the heap if they weren't already. The same can't be said about getting a value back from a pointer. GC also could potentially have less work to do. Plus I personally find ownership to be an important concept (semi-borrowed from rust) -- use of values make ownership clear.
2021-09-14 23:01:20 +10:00
YenForYang e80b989f8e
Clarify maximum value of "metadata_size" (#609) 2021-09-14 22:36:19 +10:00
YenForYang 57b4e78b0f
Inlineable `(*File).BytesCompleted()` (#612) 2021-09-14 22:11:35 +10:00
YenForYang be8b7b7d35
Optimize `LoopbackListenHost()` (#615) 2021-09-14 21:54:37 +10:00
YenForYang f6b024e157
Inlineable (*reader).SetReadAhead and (*reader).Close (#594)
Small fixes that prevent inlining of public functions
2021-09-14 14:05:37 +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 2203b3bcdf
Cheaper byte to string conversion (#602)
Revamped https://github.com/anacrolix/torrent/pull/587
2021-09-14 10:41:04 +10:00
YenForYang 5332d3e9d4
Inlineable reader.Seek and no-lock return for bad whence (#577)
* Inlineable reader.Seek and no-lock return for bad whence

Couldn't find an elegant way to early exit on bad whence. Using a closure could reduce code duplication slightly, but it's overkill for only 3 cases.

Note that returning 0 on an invalid whence is the behavior of `strings.Reader` and `bytes.Reader`.

* Update reader.go
2021-09-13 22:52:58 +10:00
YenForYang 134eea8418
Fix usages of eachListener() and make inlineable (#599) 2021-09-13 21:35:51 +10:00
YenForYang 52e8c82999
Inlineable methods to access File piecePriority (#601) 2021-09-13 21:17:54 +10:00
YenForYang 5c440e8929
Simplify (*Torrent).gotMetainfo (#581) 2021-09-13 11:41:11 +10:00