Commit Graph

184 Commits

Author SHA1 Message Date
Matt Joiner 14cf045b6a
Sleep webseed peers after unhandled errors 2022-12-31 11:27:47 +11:00
Matt Joiner f75989863c
Validate received chunks before conversion to indexes
https://github.com/anacrolix/torrent/issues/791
2022-12-11 15:21:23 +11:00
Matt Joiner 3e0f34934d
gorond ./... 2022-11-15 23:31:27 +11:00
Alex Sharov caa9400c52
use rLock where can, part2 (#767) 2022-07-13 20:04:03 +10:00
Matt Joiner 214fe6b93c
Use webrtc local addr for webrtc conn peer priority
WebRTC conns are providing the correct IP for peer priority calculations, so use that instead of trying to guess (which doesn't work if there are no regular conn listeners attached to the Client.

(cherry picked from commit e86bb5fee3958dc90a3d012469b1352005d6c9ad)
2022-07-12 15:52:03 +10:00
Matt Joiner 12279621e4
Check that incoming peer request chunk lengths don't exceed the upload rate limiter burst size
Should fix #759.
2022-06-25 23:16:58 +10:00
Matt Joiner 32cdaf4ada
Update anacrolix/generics 2022-06-21 08:51:33 +10:00
Matt Joiner 0158a830f5
Add comments for #752 and #753 2022-06-14 16:02:43 +10:00
Matt Joiner 8ccacbfd17
Revert "Switch requestState to be a slice"
This reverts commit 9eb80abc29.

Via email I received a report of excessive memory use: Memory use with a slice is proportional to the total size of all torrents loaded into the Client, which can be very large.
2022-06-01 18:24:50 +10:00
Nathanael Demacon ed1fe91dd2
Implement a public `Peer.DownloadRate` (#750) 2022-05-23 10:42:51 +10:00
Matt Joiner 669c69faac
Disable update requests timer 2022-05-12 10:37:36 +10:00
Matt Joiner 9eb80abc29
Switch requestState to be a slice 2022-05-12 10:34:28 +10:00
Matt Joiner 7d4f64ce3c
Combine pending and last requested 2022-05-11 11:33:11 +10:00
Matt Joiner a54d2d81e4
Retain peer local request ordering 2022-05-09 12:05:50 +10:00
Matt Joiner 9a9c7dee00
Add and use typed roaring bitmap 2022-05-09 12:05:50 +10:00
Matt Joiner 78c36e4c2f
Add Torrent.pieceIndexOfRequestIndex 2022-05-09 12:05:12 +10:00
Alex Sharov 3a3307632a
Infer pp.Decoder.MaxLength from chunk size (#743) 2022-05-08 11:36:43 +10:00
FIGBERT 529d97b5eb
Use PeerConn logger instead of default logger (#736) 2022-04-14 19:02:45 +10:00
Matt Joiner 32501740f2
Support banning webseeds 2022-03-11 13:33:34 +11:00
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