Commit Graph

63 Commits

Author SHA1 Message Date
Matt Joiner 9ded7e7e87 Use bytes.Reader instead of bytes.Buffer in a few places 2021-05-05 15:48:57 +10:00
Matt Joiner f409daa93f PORT message belongs to BEP 5 2021-01-27 17:08:15 +11:00
Matt Joiner 6aaaaaffba Fix unreferenced variable 2021-01-19 10:55:22 +11:00
Matt Joiner c1d189ed31 Performance improvements to PEX 2020-10-23 08:58:55 +11: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
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 376ff763fe Apply staticcheck 2020-02-20 11:09:57 +11:00
Matt Joiner 5b0c895e09 Add comments 2019-10-01 18:13:55 +10:00
Matt Joiner cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner 9224303c1e Update all imports of dht to v2 2019-08-10 18:46:07 +10:00
Matt Joiner 338287486f Always return errors when handshakes or dialing fails
I intend to use xerrors-style error handling for special cases.
2019-07-19 16:15:46 +10:00
Matt Joiner 63d215568a Tidy up function signature 2019-07-19 14:56:29 +10:00
Matt Joiner e236cbf145 bencode: Fix marshalling of []byte(nil)
Also fixes #293.
2018-11-27 08:57:17 +11:00
Matt Joiner fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11: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 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 ba8ec1a787 Move back to net.IP for extended handshake message IPs 2018-07-12 00:00:07 +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 a7e338a3f1 More sortimports 2018-07-07 11:40:06 +10:00
Matt Joiner e0f0617b0b Comments and readability 2018-07-07 11:33:48 +10:00
Matt Joiner 76a3c0891a Expose handshake stuff in peer_protocol 2018-07-07 11:31:29 +10:00
Matt Joiner 54f43419e2 Fix fast extension message type constants
iota isn't worth the trouble
2018-02-05 18:00:47 +11:00
Matt Joiner 93e8d9bfaa Use stringer to generate peer_protocol.MessageType strings 2018-02-05 15:30:35 +11:00
Matt Joiner 20316e5af4 Support AllowedFast and enable fast extension 2018-02-05 00:18:38 +11:00
Matt Joiner 44e44637bf TODOs and comments 2018-02-04 19:14:07 +11:00
Matt Joiner 89b17c4372 Try to print something useful for MessageType panics 2018-02-02 21:52:57 +11:00
Matt Joiner b610107d8d Break up peer_protocol into several files 2018-02-02 21:29:57 +11:00
Matt Joiner c9507786f2 Count requested chunk lengths
Have seen some very ridiculous lengths causing data read errors
2018-02-02 16:06:24 +11:00
Matt Joiner 092b139dcf Fix peer_protocol benchmark 2018-01-25 17:43:45 +11:00
Matt Joiner 0b553b296f Add File priorities
Fixes #220.
2018-01-21 22:49:12 +11:00
Matt Joiner 9757f04cf8 Apply megacheck to torrent package 2017-11-07 16:11:59 +11:00
Matt Joiner 3ed8274384 Abstract out making a cancel message 2017-09-18 13:42:42 +10:00
Matt Joiner 260806a6f2 peer_protocol: Improve piece decoding benchmark 2017-09-12 21:32:01 +10:00
Matt Joiner 01fee38709 peer_protocol: Add a benchmark for decoding pieces 2017-09-12 21:12:56 +10:00
Matt Joiner 3eb422afd0 Add peer_protocol.Message.MustMarshalBinary 2017-08-31 14:30:53 +10:00
Matt Joiner 47ef753795 peer_protocol.Decoder.Decode: Avoid allocating another intermediate reader
On my system, BenchmarkConnectionMainReadLoop goes from 596 to 1311 MB/s.
2016-09-25 10:31:43 +10:00
Ye Yin d3963eedfd Use sync.pool for decode buffer 2016-09-12 17:32:04 +10:00
Matt Joiner 380dc7a2b4 Add peer_protocol.Integer.Int() 2016-02-21 17:25:26 +11:00
Matt Joiner e85b7e228b Add support for Fast Extension 2015-03-12 20:06:23 +11:00
Matt Joiner c9bc892789 Implement the DHT Port message 2014-08-25 22:12:16 +10:00
Matt Joiner a2fabedfa2 Clarify EOF in message decoding 2014-08-22 17:39:18 +10:00
Matt Joiner 6da2b7ee00 Fix peer_protocol test 2014-07-18 02:38:32 +10:00