Commit Graph

61 Commits

Author SHA1 Message Date
Matt Joiner 5f1d937b62 Add connection trust flag, and more tests with small caches
Thanks to observations and feedback from @ccampbell.
2019-12-18 13:52:00 +11:00
Matt Joiner cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner 1dc406c81c Move IpPort to missinggo 2018-11-16 10:35:30 +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 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 f5bd377941 Change pieceIndex to peer_protocol.Integer 2018-07-12 09:15:15 +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 fad06c7ddf sortimports 2018-07-07 11:36:58 +10:00
Matt Joiner e1d6fc2341 Add torrent.InfoHash type alias 2018-07-07 11:32:52 +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 ab48d4731c Include rate limiting and stats in BenchmarkConnectionMainReadLoop 2018-06-11 12:20:51 +10:00
Matt Joiner 319e57d1c6 Rework conns to/and allow multiple DHT servers
This will help with #229, and IPv6 support.
2018-04-12 11:41:07 +10:00
Matt Joiner 646622b8f1 Move clamp and max, and add min to misc.go 2018-02-16 12:14:15 +11:00
Matt Joiner d6f6359799 Remove errant log message 2018-02-14 01:14:05 +11:00
Matt Joiner 39bde7237e Try to count IPv6 connections 2018-02-13 00:48:21 +11:00
Matt Joiner 738a75bc1c Prepare to support sending reject messages 2018-02-03 13:35:09 +11:00
Matt Joiner ffe778392c request can be made from Reject and Cancel messages too 2018-02-02 23:56:06 +11:00
Matt Joiner 7a95714df2 Factor out connection.onReadRequest 2018-02-02 19:19:14 +11:00
Matt Joiner 7eb62eec0d Move some code around 2017-11-08 15:00:18 +11:00
Matt Joiner fdf75d59c8 Kick only the worst connection when a piece fails a check 2016-11-23 12:59:23 +11:00
Matt Joiner 4d10fd3496 Fix issue #112 2016-09-12 16:54:43 +10:00
Matt Joiner da4d40ed7e Merge all our global consts and vars into global.go
For easier referral to other parties.
2016-04-14 17:19:07 +10:00
Matt Joiner fda1cc3f7b Remove more deadcode 2016-04-04 15:23:05 +10:00
Matt Joiner 1566e2afdc Remove deadcode 2016-04-04 15:18:51 +10:00
Matt Joiner b80bb6393a Use metainfo.Hash for piece and info hashes 2016-04-04 13:01:31 +10:00
Matt Joiner 775cf53809 Get mmap storage working 2016-03-28 21:57:04 +11:00
Matt Joiner bb04cb8843 Tidy up bytesLeft calculations
This should fix a bug where completion is shown as negative in WriteStatus
2016-03-22 13:11:36 +11:00
Matt Joiner 06ebc4c37e Explicitly import Torrent.InfoHash 2015-08-02 03:55:48 +10:00
Matt Joiner c018c660f0 Allow chunk size to be specified per torrent 2015-07-15 15:31:18 +10:00
Matt Joiner dd34efad57 Comments and update version strings 2015-06-28 16:40:46 +10:00
Matt Joiner af127dfd0f Add some metainfo validation 2015-06-03 00:17:58 +10:00
Matt Joiner ade6087b2f Move torrentOffsetRequest and torrentRequestOffset, fixing a bug in former, and test it 2015-04-08 02:20:01 +10:00
Matt Joiner 533c034747 import pp peer_protocol in misc.go 2015-04-08 02:17:15 +10:00
Matt Joiner 6c48d59adb Move piece into its own file 2015-04-08 02:14:35 +10:00
Matt Joiner 67f90ed886 More public interface tidying 2015-03-20 23:52:53 +11:00
Matt Joiner 842a32ae0c Rewrite import paths for migration from Bitbucket 2015-03-20 16:37:44 +11:00
Matt Joiner e6fbde0dc6 Rework piece completion 2015-03-11 02:41:21 +11:00
Matt Joiner ad6ac3f2cd More cleaning of public interface 2015-03-08 17:28:14 +11:00
Matt Joiner a2d69b4931 Make blob data stateful 2015-02-27 12:45:55 +11:00
Matt Joiner 4b1b009049 Encapsulate torrent data, and provide os.File and mmap-based implementations 2015-02-10 00:14:52 +11:00
Matt Joiner d54c5ddf24 Remove a bunch of dead code 2014-12-28 12:51:09 +11:00
Matt Joiner b6ae4caa6a Set priorities ahead of the current read position 2014-12-05 00:56:28 -06:00
Matt Joiner ac1afa19b8 mmap_span: Avoid allocating the span slice on every use 2014-12-05 00:54:55 -06:00
Matt Joiner 91c2c1f5c7 Piece priorities, torrent read interface and many fixes 2014-12-03 01:07:50 -06:00
Matt Joiner 5c8de6dd7c Skip mapping files with length 0 2014-12-01 19:13:08 -06:00
Matt Joiner 18d6f81184 Add InfoHash.HexString convenience 2014-12-01 16:34:45 -06:00
Matt Joiner 358f089515 Set a minimum dial timeout 2014-11-18 21:53:00 -06:00
Matt Joiner eeae2d3285 Actually announce to DHT, don't just get peers 2014-11-16 13:18:08 -06:00
Matt Joiner 713cf7e71f Extend the dial timeout to 30s 2014-08-22 17:40:22 +10:00
Matt Joiner 063e02cbfd Avoid allocations in shuffledPendingChunkSpecs 2014-08-22 17:37:18 +10:00