Commit Graph

165 Commits

Author SHA1 Message Date
Matt Joiner 7a20e9fe8a Lazy logging 2022-01-23 09:37:11 +11:00
Matt Joiner 1cff4fe95e Switch to external anacrolix/generics 2022-01-22 18:43:04 +11:00
Matt Joiner 4a8611b23e Do smart banning on existing badPeerIPs 2022-01-22 18:43:04 +11:00
Matt Joiner 53cf508061 Implement smart ban using generics 2022-01-22 18:43:04 +11:00
Matt Joiner c17186bf85 Switch from missinggo/MultiLess to anacrolix/multiless 2022-01-12 15:07:26 +11:00
Matt Joiner 83a8284d6a Add tests for preferred network direction 2022-01-12 15:01:33 +11:00
Matt Joiner 2e9ecd5a32 Reject peer requests on data read failures 2021-12-27 22:19:04 +11:00
Matt Joiner f7494791d0 Reduce some logging 2021-12-27 22:06:52 +11:00
Matt Joiner 1bae62fd22 Dynamic outbound max requests
This might be one solution to https://github.com/anacrolix/torrent/issues/698.
2021-12-24 08:55:57 +11:00
Matt Joiner 506ff8d037 Use relative availabilities to determine piece request order
Most overhead comes from peers that connect that have everything, and we just increment every single piece's availability. There may be some unresolved determinism with torrents that share the same ordering.
2021-12-23 14:00:00 +11:00
Matt Joiner bdb33ef9f7 gofumpt -extra 2021-12-23 14:00:00 +11:00
Matt Joiner 9d9556c97f Add Peer.cancelAllRequests for webseedPeer 2021-12-13 12:11:38 +11:00
Matt Joiner 98f188dcbe Update requests after deleting all in some corner cases
Choked by non-fast PeerConn, deleted PeerConn. They're not exactly guarded as strictly as they could be, so there's plenty of room for performance improvements here.
2021-12-13 12:09:12 +11:00
Matt Joiner 47ef8d9c2d Assert that a request isn't cancelled before requesting it again 2021-12-13 11:56:57 +11:00
Matt Joiner 04beb8937f More consistent cancellation management 2021-12-12 18:35:02 +11:00
Matt Joiner ddf41fc2f1 Add Torrent-level request cancel for consistency 2021-12-12 18:35:01 +11:00
Matt Joiner aca22a0896 Update peer cancel assumptions and return 2021-12-12 18:35:01 +11:00
Matt Joiner 117ae28b38 Try request stealing 2021-12-12 18:35:01 +11:00
Matt Joiner 99a64bcf63 Wait between duplicate requests 2021-12-12 18:35:01 +11:00
Matt Joiner 6625b05da4 Add more identifying information to PeerConn.String
Some logs for unexpected protocol violations could be helped by them.
2021-12-12 16:56:01 +11:00
Matt Joiner 96ef73aeb6 Transmission does not reject cancelled requests 2021-12-12 16:56:01 +11:00
Yaroslav Kolomiiets 4a06517856 PEX: fluid event log 2021-12-12 00:27:28 +11:00
Matt Joiner ab78c449b7 Reduce idle request updates due to choke and unchoke messages 2021-11-29 12:12:30 +11:00
Matt Joiner 51f6f07633 Peers with all pieces have wanted pieces only if we want any piece 2021-11-28 22:36:19 +11:00
Matt Joiner 8e5ae65837 Quote peer extension names to expvar 2021-11-19 13:02:42 +11:00
Matt Joiner 2f907e84a8 Optimize PeerConn.peerHasAllPieces 2021-11-17 14:01:11 +11:00
Matt Joiner 0f81e0011f Avoid calling net.Conn methods with the Client mutex locked
The utp firewall callback might want to use it. I can't think of a better way to determine with an incoming connection request should be blocked.
2021-11-17 14:00:50 +11:00
Matt Joiner 2fd928b918 Don't use non-directory webseed URLs for multi-file torrents 2021-11-12 12:37:40 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner f2e9eeba3b Check if torrent is closed before handling peer request data read failures
Should fix panics using storage after its been closed, like in https://github.com/anacrolix/torrent/runs/4017475163.
2021-10-27 15:14:11 +11:00
Matt Joiner 31985f1ea0 Add Peer.mustRequest 2021-10-26 15:03:04 +11:00
Matt Joiner 344ada8b7c Add disabled code for limiting wasted chunks 2021-10-25 21:37:25 +11:00
Matt Joiner e8067f741f Always count unhandled requests as pending
Fixes https://github.com/anacrolix/torrent/issues/679.
2021-10-25 16:36:58 +11:00
Matt Joiner 28726f737c Record webseed request result bytes against client stats
Should fix the issue where webseeds cause >100% useful data readings.
2021-10-25 16:17:55 +11:00
Matt Joiner e884b8079b Fix panic when sustaining unrejected requests after being choked
Fixes https://github.com/anacrolix/torrent/issues/680.
2021-10-25 13:00:56 +11:00
Matt Joiner ff3c186396 Add low requests check
This is an optimization for webseeds, which have 10 synchronous request routines, and if the request count dips below 10, some sit idle. There is probably something similar to be done with PeerConns, which won't update until there are zero requests, but there there is a timer to refresh updates, and the queues are very long (typically 512-2048).
2021-10-21 10:48:43 +11:00
Matt Joiner 8eec0b665e Update webseeds for peer requesting 2021-10-21 10:28:57 +11:00
Matt Joiner 92d3e1ed6d Remove unused peerImpl methods 2021-10-20 16:35:45 +11:00
Matt Joiner 9625553fd2 Demote some recent logs to debug 2021-10-20 11:22:35 +11:00
Matt Joiner e31e191c8d Improve protocol behaviour logging 2021-10-20 11:22:20 +11:00
Matt Joiner e51accb3e2 Don't error receiving unchoke while already unchoked 2021-10-19 14:08:56 +11:00
Matt Joiner 2f01dbab80 Include pending cancel count in peer status 2021-10-19 14:08:56 +11:00
Matt Joiner ccce2dba13 Improvements to request refreshing 2021-10-19 14:08:56 +11:00
Matt Joiner 1201ccc53b Refresh requests after a second of no updates 2021-10-19 14:08:56 +11:00
Matt Joiner a7d3296003 Use roaring.Bitmap.IsEmpty where appropriate 2021-10-19 14:08:56 +11:00
Matt Joiner 529aaa9b1f Use roaring bitmap for pending pieces
Also makes a significant optimization for peerHasWantedPieces possible.
2021-10-19 14:08:56 +11:00
Matt Joiner 23b4e2dc9c Wait for cancelled requests to be rejected per the spec 2021-10-19 14:08:56 +11:00
Matt Joiner 3f3bcab0d8 Track requests that are preserved across chokings 2021-10-19 14:08:56 +11:00
Matt Joiner 5f31bd83b3 Some fixes to pending request accounting 2021-10-19 14:08:56 +11:00
Matt Joiner b2cabe7dbf Handle allowed fast while choked when requests already exist in the same piece 2021-10-19 14:08:56 +11:00