2
0
mirror of synced 2025-02-23 22:28:11 +00:00

80 Commits

Author SHA1 Message Date
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
Matt Joiner
7410e28329 Fix peer request sleepiness
New requests weren't being issued to the current peer when being deleted. For webseeds, this would cause them to not bother issuing new requests indefinitely.

(cherry picked from commit 146a16df4ea26d33b0ce0391c8220de14c9e18f4)
2020-10-30 09:13:39 +11:00
Matt Joiner
845d3fbe8f Remove some unused code 2020-10-27 17:56:55 +11:00
Matt Joiner
c1d189ed31 Performance improvements to PEX 2020-10-23 08:58:55 +11:00
Matt Joiner
635ec27fb3 Don't update requests for the current connection first when a request is deleted 2020-10-15 12:56:06 +11:00
Matt Joiner
4a4cb5dc58 Ensure PeerConn._close is called for incoming connections
This fixes missing calls to PeerConnClosed callback.
2020-10-14 15:11:45 +11:00
Matt Joiner
02f82131ea Move pexConnState from peer to PeerConn 2020-10-13 13:33:22 +11:00
Matt Joiner
152d8715ff Add PeerConnClosed callback 2020-10-13 13:02:39 +11:00
Matt Joiner
6ed1062176 Fix some log levels 2020-10-12 17:12:34 +11:00
Matt Joiner
417d7d1d48 Tweaks to storage error and completion handling 2020-10-11 12:54:03 +11:00
Matt Joiner
a9102abf1d Tidy up some logging 2020-10-10 10:24:58 +11:00
Matt Joiner
014cb3986b Fix PeerConn conn status string 2020-10-06 09:50:47 +11:00
Matt Joiner
1cdae13700 Fix conn status string for WebRTC connections 2020-09-29 16:21:54 +10:00
Matt Joiner
4dee11efe9 Fix panic for unexpected piece rejections
Should fix #419.
2020-09-03 14:34:06 +10:00
Matt Joiner
dd906f8fa7 Add ReadExtendedHandshake callback 2020-07-15 16:16:14 +10:00
Matt Joiner
9d0ea15044 Expose peer.RemoteAddr 2020-07-15 16:16:14 +10:00
Matt Joiner
7ee0fdafe3 Add some client callbacks 2020-07-15 16:16:14 +10:00
Matt Joiner
8606385985
Merge pull request #410 from anacrolix/webseeds
* Rename Peer to PeerInfo, and unexport PeerInfos

* Break peer out from PeerConn

* Abstract out segments mapping and use it in mmap storage

* Got file storage working with segment index

* Fix race in webtorrent.TrackerClient.Run

* storage file implementation: Error on short writes

* Remove debug logging from storage file implementation

* cmd/torrent-verify: Fix piece hash output

* Support disabling webtorrent

* Further progress on webseeding

* Handle webseed Client events

* Rename fastestConn->fastestPeer

* Add webseeds from magnet links

* Remove events from webseed

Manage this stuff inside the webseed peer instead.

* Make use of magnet source fields and expose Torrent.MergeSpec

* Add option to disable webseeds

* Fix webseeds when info isn't available immediately

* Handle webseed request errors

* Tidy up the interface changes
2020-06-03 11:25:08 +10:00
Matt Joiner
8a2ff43246 Tidy up the interface changes 2020-06-02 17:41:59 +10:00