Commit Graph

50 Commits

Author SHA1 Message Date
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
Matt Joiner d5a482e209 Handle webseed request errors 2020-06-02 16:41:49 +10:00
Matt Joiner 7909084a17 Fix webseeds when info isn't available immediately 2020-06-02 16:18:25 +10:00
Maxb d7627143bc Add per-torrent ability to disable uploading 2020-06-02 11:20:39 +10:00
Matt Joiner eb8688a902 Rename fastestConn->fastestPeer 2020-06-01 19:09:17 +10:00
Matt Joiner ff53ab860c Further progress on webseeding 2020-06-01 18:25:45 +10:00
Matt Joiner 317146dec9 Export PeerImpl and all its methods 2020-05-31 13:22:36 +10:00
Matt Joiner 3f8f6e1733 Got things compiling 2020-05-31 13:09:56 +10:00
Matt Joiner 3d1f08b12f Save progress 2020-05-30 17:52:27 +10:00
Matt Joiner de88c620bc Seperate peer and PeerConn 2020-05-30 15:18:28 +10:00
Matt Joiner 02adc3f2ee Break peer out from PeerConn 2020-05-30 10:14:20 +10:00
Matt Joiner 9edd98ad78 Close PeerConn.conn synchronously 2020-05-03 18:40:40 +10:00
Matt Joiner a7b665873c Propagate and log more connection read/write errors now that logging is a bit fancier 2020-05-03 18:40:09 +10:00
Matt Joiner dad5ab89a5 Limit the write buffer to work around a webrtc datachannel issue
https://github.com/pion/datachannel/issues/59. Fixes https://github.com/anacrolix/torrent/issues/402.
2020-05-03 18:39:16 +10:00
Matt Joiner 3e9a5a4aec Expose ClientConfig.Extensions
Also run the storage failure test with fast disabled for the seeder. This probably would have tickled some issues in the past, so it seems like a good place to try it out.
2020-04-23 13:03:40 +10:00
Matt Joiner 86d5ad4b2c Don't delete requests if we're choked per BEP 6
This should make the expected receive chunk counts match up more correctly. It doesn't seem to affect tests at the moment, but then we don't verify the expected receive chunk counts are correct either.
2020-04-23 12:36:19 +10:00
Matt Joiner 12e377e3fe Count expected received chunks instead of flagging them
This can be racy. In the TestReceiveChunkStorageFailure, when we have a storage write failure, we request the chunk again, but the peer has sometimes already sent it, and we return from the connection read loop with unexpected chunk after receiving it twice.
2020-04-23 12:34:43 +10:00
Matt Joiner 4a2802a702 Logging fixes 2020-04-18 17:45:01 +10:00
Matt Joiner d05ce2d274 Update anacrolix/log 2020-04-16 17:20:58 +10:00
Yaroslav Kolomiiets 26071eaad0 PEX: integrate with send throttling 2020-04-16 09:37:38 +10:00
Matt Joiner 3d87c20766 Count outgoing extended messages by extension protocol 2020-04-15 18:09:15 +10:00
Matt Joiner c27e3f8de3 Merge branch 'webtorrent' 2020-04-15 17:26:46 +10:00
Yaroslav Kolomiiets 2b2c480706 PEX: add periodic deltas 2020-04-15 17:24:44 +10:00
Yaroslav Kolomiiets 93430aa01a PEX: add connection tracking 2020-04-15 17:24:44 +10:00
Yaroslav Kolomiiets 634edd2875 Share current connections with peers over PEX (anacrolix#341) 2020-04-15 17:24:44 +10:00
Matt Joiner 8f04efa2db Fix panic in status for webrtc connections 2020-04-13 14:08:32 +10:00
Matt Joiner f45dac1e38 Use offer_id for webrtc conn string 2020-04-13 14:04:34 +10:00
Matt Joiner bae791a5a2 Disable data downloading on storage write errors
Also add a hook and Torrent methods to modify this.
2020-02-22 19:40:50 +11:00
Matt Joiner ddc61845ac Misc cleanup 2020-02-22 19:38:56 +11:00
Matt Joiner ddddc63924 Expose PeerConn.PeerPieces
Fixes #375.
2020-02-21 11:51:24 +11:00
Matt Joiner dff436f102 Rename connection->PeerConn and fix exports 2020-02-21 11:07:50 +11:00