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
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
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
Matt Joiner
72c74f7800
Remove unused code
2021-08-19 16:06:46 +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
d42f2516a4
Increase request update interval if there's no signalling
2021-08-01 22:52:51 +10:00
Matt Joiner
15f8e77519
Add explicit metadata extension types
2021-06-21 12:14:06 +10:00
Matt Joiner
7d9e2b18d6
Extract chansync to github.com/anacrolix/chansync
2021-06-07 13:01:40 +10:00
Matt Joiner
c895a21a16
Track chunks read for webseed peers too
2021-06-07 13:01:40 +10:00
Matt Joiner
36f52d7a14
Apply next request state asynchronously
2021-06-07 13:01:40 +10:00
Matt Joiner
d37dea1f61
Move peerConnMsgWriter into its own file
2021-06-07 13:01:40 +10:00
Matt Joiner
24ceed61da
Break out peerConnWriter
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
a26e7f9933
Determine peer max requests based on receive speed
2021-06-07 13:01:39 +10:00
Matt Joiner
86524214f5
Merge maxRequests into localClientReqq
2021-06-07 13:01:39 +10:00
Matt Joiner
233135493f
Improve num requests per piece status output
2021-06-07 13:01:39 +10:00
Matt Joiner
09823b9e36
Rework to improve work stealing and try to thread peers through all request pieces
2021-06-07 13:01:39 +10:00
Matt Joiner
b508877d82
Track peer availability at the Torrent-level
2021-06-07 13:01:39 +10:00
Matt Joiner
9c9ba1aeac
PeerConn.post becomes PeerConn.write
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
6e97ce952f
Tidy up request and cancel
2021-06-07 13:01:39 +10:00
Matt Joiner
b2c68b314b
Limit outstanding requests
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
a44f9921aa
Remove github.com/pkg/errors use in peerconn.go
...
Was contributing to unexpected CPU use, and it's way out of date.
2021-05-14 15:42:07 +10:00
Matt Joiner
f01d93cee0
Track chunks received in nexted expvar.Map
2021-05-14 15:42:02 +10:00
Matt Joiner
ee572c5822
Track peers supporting extension in a nested expvar.Map
2021-05-14 15:41:14 +10:00
Matt Joiner
1080c837b9
Remove separate postedKeepalives expvar
2021-05-14 15:38:38 +10:00
Matt Joiner
95d72a452a
Reduce allocations in iterBitmapsDistinct
2021-05-08 10:35:23 +10:00
Matt Joiner
0cc655deed
Fix closing of webseed peers
2021-02-09 19:21:54 +11:00
Matt Joiner
68d8604c20
We're not expecting chunks if we have no outstanding requests
2021-01-29 16:14:08 +11:00
Matt Joiner
43a2942b98
Set not interested when we have no pending requests
2021-01-29 16:13:46 +11:00
Matt Joiner
1ac5811990
Remove requests as soon as chunk data is received
...
Note that this breaks the backpressure on webseed responses again, and should be fixed shortly.
2021-01-28 16:36:35 +11:00
Matt Joiner
ca1497ad58
Add peer upload order analysis
2021-01-28 16:31:13 +11:00
Matt Joiner
47d6282e54
Don't cancel request on current peer when receiving chunk
2021-01-28 14:26:10 +11:00
Matt Joiner
456a2f7c5d
Expose more callbacks and Request and ChunkSpec
2021-01-28 14:23:22 +11:00
Matt Joiner
b5215ea7e8
Expose Peer.Network to replace Peer.RemoteAddr.Network
2021-01-25 15:49:48 +11:00
Matt Joiner
9f9953be52
Don't expose Peer network through RemoteAddr
2021-01-25 15:49:48 +11:00
Matt Joiner
669905e203
Add ReceivedUsefulData Callback
2021-01-25 15:49:48 +11:00
Matt Joiner
27108bd2f7
Export Peer
2021-01-25 15:49:48 +11:00
Matt Joiner
bbfc38c44a
Fix call to wrong postCancel?
...
Looks like this would forget to also cancel the request on the peer, and only send the message.
2021-01-19 10:55:13 +11:00
Matt Joiner
ded6c19edb
Add the DropMutuallyCompletePeers ClientConfig field
2021-01-05 16:58:45 +11:00
Matt Joiner
133cc17c00
Some peerImpl observations
2021-01-04 15:51:23 +11:00
Matt Joiner
de964db3c2
Don't send keepalives if a connection isn't useful to us
...
This might help break the situation where anacrolix/torrent Clients that are connected to each other never release a connection until there's new connections that look more promising.
2020-12-10 11:13:45 +11:00
Matt Joiner
0d40c4bac2
Read peer request data without Client lock
2020-11-16 16:37:11 +11:00
Matt Joiner
b020b8c2b6
Add support for the x.pe magnet link parameter
2020-11-16 16:37:11 +11:00
Matt Joiner
dcb2c0bb41
Fix piece getting queued for hash multiple times
...
Pieces could get queued for hash multiple times when we receive chunks if the piece starts getting hashed before we're done writing all the chunks out. This was only found because piece hashing currently only checks the incomplete data, which is missing after the first piece hash passes, the data is marked complete, then the subsequently queued hash has nothing to read.
2020-11-06 08:39:56 +11:00
Matt Joiner
7b2a7a667d
Remove old comment
2020-11-04 11:34:24 +11:00
Matt Joiner
c28e9aaeae
Don't delete requests until after they're written to disk
...
This prevents too many pending writes building up. Webseed peers re-request synchronously, and the writes are done asynchronously, so they download too quickly and there was no backpressure. The backpressure now is provided by the upper limit on outstanding requests per connection.
2020-10-30 12:19:53 +11:00