Commit Graph

3053 Commits

Author SHA1 Message Date
Matt Joiner 03f8ec7090 Fix fuzz comparison of big.Int 2021-09-29 12:11:17 +10:00
Matt Joiner 2daad6e564 Update fuzz to use new standard library support 2021-09-29 11:51:03 +10:00
Matt Joiner a9aec0bb79 Simplify bencode.Decoder.parseStringInterface 2021-09-29 09:50:01 +10:00
YenForYang 37455d3c6b
bencode: optimize `(*Decoder).parseStringInterface()` (#659) 2021-09-29 09:30:35 +10: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
YenForYang 644a746b6b
Inlineable `addrIndex` (#673) 2021-09-27 12:41:20 +10:00
YenForYang 76f593e36b
Eliminate `expect` dependency (#667) 2021-09-24 00:10:30 +10:00
Matt Joiner a330b23e9e Default to peer requesting disabled
There are some flaws that need to be fixed up before it might be considered the default.
2021-09-21 16:07:08 +10:00
Matt Joiner ebd523e39c cmd/torrent: Don't make --stats default to --debug's value 2021-09-21 13:06:06 +10:00
Matt Joiner b6182bdce9 Remove unused function 2021-09-21 13:05:16 +10:00
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