Commit Graph

1939 Commits

Author SHA1 Message Date
Matt Joiner 6d6197b0a1 Switch pieceIndex back to an int
I suspect that interface conversions using packet iter are causing a lot of allocation. Either way, with the casting this adds, we should be able to change pieceIndex's type alias now with minimal code change.
2018-07-17 21:28:01 +10:00
Matt Joiner b00711bb68 bencode: Avoid Value.Interface call testing for big.Int
Was resulting in significant allocation.
2018-07-17 21:25:15 +10:00
Matt Joiner 216cb7e356 Don't randomize chunk order for requestStrategy 3
This should also reduce a lot of allocation.
2018-07-17 15:08:46 +10:00
Matt Joiner 4db3870836 Reduce default handshake timeout to 3s 2018-07-15 13:01:22 +10:00
Matt Joiner f22be3892f Calculate peer priority lazily for worse conn comparison 2018-07-15 12:57:52 +10:00
Matt Joiner bd5ae2cb6d Fix doc comment 2018-07-15 12:56:28 +10:00
Matt Joiner 5fb5010762 Fix connection.utp 2018-07-15 12:55:49 +10:00
Matt Joiner d4d3e24c6f Track metadata chunks read with its own Count 2018-07-15 10:09:58 +10:00
Matt Joiner 91730696cf Rewrite piece data decoding and relax test 2018-07-14 11:50:43 +10:00
Matt Joiner 01380adac3 peer_protocol: Add a test for receiving overlong piece data
The chunk buffer pool decides the upper bound on chunk data len.
2018-07-14 11:37:56 +10:00
Matt Joiner d4d8f78906 Send extended message before fast/bitfield
This is how Transmission does it.
2018-07-14 11:28:54 +10:00
Matt Joiner cc6441a791 Fix peer_protocol.Message.RequestSpec for Type Piece 2018-07-13 21:33:21 +10:00
Matt Joiner c001e6e008 Add a test that short pieces are decoded correctly 2018-07-12 09:54:06 +10:00
Matt Joiner 324cc7a281 Comments and trivial tweaks 2018-07-12 09:42:00 +10:00
Matt Joiner ee985e51cb Add peer_protocol.Integer.Uint32 2018-07-12 09:16:40 +10:00
Matt Joiner 86ca9ffa7e Add peer_protocol.RequestSpec 2018-07-12 09:16:17 +10:00
Matt Joiner f5bd377941 Change pieceIndex to peer_protocol.Integer 2018-07-12 09:15:15 +10:00
Matt Joiner ba8ec1a787 Move back to net.IP for extended handshake message IPs 2018-07-12 00:00:07 +10:00
Matt Joiner a4a123b04e Don't error on bencode dicts that can't be marshalled
Have seen metainfo announce-lists that are lists of dicts. Possibly ignoring type errors with a tag would be smarter but I'm undecided.
2018-07-11 15:33:41 +10:00
Matt Joiner 04fa1b8d4c Support marshalling bencode strings into byte arrays 2018-07-11 15:22:29 +10:00
Matt Joiner de08380464 Decide where to set proxy for HTTP trackers
Remove old ClientConfig.setProxyURL, set this directly now through ClientConfig.TrackerHttpClient.Transport.Proxy (if your Client allows it).
2018-07-11 15:10:58 +10:00
Matt Joiner b9cfe71d90 Remove debug log 2018-07-10 13:14:39 +10:00
Matt Joiner 2685ef6aa9 Use half open limit directly from Config 2018-07-10 12:23:00 +10:00
Matt Joiner 1f6ba94882 Make extended handshake a struct, and move a bunch of extended stuff into peer_protocol 2018-07-10 12:20:36 +10:00
Matt Joiner 50def7a688 Move PEX stuff into peer_protocol 2018-07-10 11:21:24 +10:00
Matt Joiner e3cb94006c Reinstate the reduce dial timeout and update some values
Fixes #263
2018-07-10 11:19:14 +10:00
Matt Joiner f149d0b82a bep40Priority: Include error in return 2018-07-10 11:14:23 +10:00
Matt Joiner ba9935d522 Add more worseConn comparisons
Should fix #264.
2018-07-10 09:50:39 +10:00
Matt Joiner a7e338a3f1 More sortimports 2018-07-07 11:40:06 +10:00
Matt Joiner fad06c7ddf sortimports 2018-07-07 11:36:58 +10:00
Matt Joiner 316640f921 Fix panic when failing to parse tracker URL 2018-07-07 11:35:47 +10:00
Matt Joiner e0f0617b0b Comments and readability 2018-07-07 11:33:48 +10:00
Matt Joiner e1d6fc2341 Add torrent.InfoHash type alias 2018-07-07 11:32:52 +10:00
Matt Joiner 76a3c0891a Expose handshake stuff in peer_protocol 2018-07-07 11:31:29 +10:00
Matt Joiner a69cd7bb9b fs/test.sh: Add sudo before happy path umount again 2018-06-30 22:03:29 +10:00
Matt Joiner 5f20a21c9d Change the duplicateRequestTimeout to 1s 2018-06-30 21:10:48 +10:00
Matt Joiner 15f3c822c5 Assume connections have half the download bandwidth than calculated 2018-06-30 21:10:23 +10:00
Matt Joiner b2117bc571 Use timers for duplicate requests
Nothing was triggering request updates when timeouts expired. This is the simplest fix, no performance considered.
2018-06-30 00:10:31 +10:00
Matt Joiner 716fd43d44 Run fs/test.sh in a temporary directory and make it clean up 2018-06-30 00:08:01 +10:00
Matt Joiner a3bc6398c8 Merge messageTypes{Sent,Posted} into torrent expvar 2018-06-29 22:10:21 +10:00
Matt Joiner 60dd0eed53 Make requestStrategy 3 the default
Fixes #253.
2018-06-28 12:06:21 +10:00
Matt Joiner 7b924822c7 Fix panic in connection.iterPendingPieces when the info isn't available
Triggered by connection.iterUnbiasedPieceRequestOrder calling Torrent.numPieces. We shouldn't be iterating pieces when there's no info anyway, so don't yield any. Mentioned in https://github.com/anacrolix/torrent/issues/253#issuecomment-400350386.
2018-06-28 11:12:49 +10:00
Matt Joiner bdf8619cf3 Missed deferring release of an exported status writer 2018-06-26 21:19:49 +10:00
Matt Joiner 8255194c64 Fix racy Torrent.wantConns check when adding connections 2018-06-26 20:47:21 +10:00
Matt Joiner 6212973011 Add more context to an error 2018-06-26 20:24:39 +10:00
Matt Joiner 57849844ae Rework status export in tests to allow count > 1 without a server for every test 2018-06-26 19:54:48 +10:00
Matt Joiner c921242f30 Do requests synchronously, and don't request from hashing or queued pieces
Calculating the desired state was a nice idea, but too hard to debug. This way should also be faster.
2018-06-26 14:51:55 +10:00
Matt Joiner 7dd532d46f Check that chunks we request aren't being hashed or queued for hash 2018-06-26 13:04:15 +10:00
Matt Joiner 67c0ed8518 Fix BenchmarkConnectionMainReadLoop 2018-06-25 14:09:08 +10:00
Matt Joiner 85dc3c204a Rework stats for receiving chunks
Related to #253.
2018-06-25 14:06:30 +10:00