Commit Graph

75 Commits

Author SHA1 Message Date
Matt Joiner 0ad4dda9fc Move fillRequests and replenishConnRequests into connection.go 2016-01-24 15:21:17 +11:00
Matt Joiner 06445f2a1e It's working and the tests are usually passing
I still need to handle "prefetch"-style downloading, and some functions haven't been committed to force this issue.
2016-01-18 18:35:14 +11:00
Matt Joiner 09050ff2c5 Some missing hunks that fix build 2016-01-04 22:56:36 +11:00
Matt Joiner 3c446086af Add Have and Bitfield connection methods 2016-01-04 22:37:49 +11:00
Matt Joiner 58c997210e Track peer sources with a dict, and don't exceed high water mark 2015-09-28 15:30:13 +10:00
Matt Joiner 53259397fc Initialize connection piece priorities lazily, and using a pool 2015-09-26 17:27:35 +10:00
Matt Joiner 54339a30e3 Drop connections that contributed to pieces that failed to hash
There are peers out there that seem to intentionally spam bad data, and the same pieces will often fail continuously. This really puts a bee in their bonnet.
2015-08-04 01:12:09 +10:00
Matt Joiner 1cc50f85a6 connection.writer wasn't working efficiently
Because of the pseudo-random selection of a communication in a select statement, flushing was occuring prematurely. Also the buffer was needlessly large. For large messages, like outgoing pieces, it's probably better they just go straight to the wire anyway.

This change will make it easier to implement sending of pieces that doesn't block control messages in the future. Any time that the buffer is empty, we'll be able to signal that it's an optimal time to send a piece.
2015-08-02 20:39:31 +10:00
Matt Joiner 7ecc8108bf Track connection writes and flushes
Helps determine efficiency of the routine.
2015-08-02 14:30:33 +10:00
Matt Joiner 06dede5690 Track the connection flags for completed handshakes 2015-08-02 04:06:22 +10:00
Matt Joiner 58dd6ddf93 Implement Stringer on connection 2015-06-29 19:37:52 +10:00
Matt Joiner 859129fb28 Print peer IDs as escaped ascii 2015-06-22 19:46:26 +10:00
Matt Joiner ced5733c88 Improve uploading/seeding 2015-06-16 16:57:47 +10:00
Matt Joiner a2df9f8b01 Miscellaneous changes 2015-06-03 00:03:43 +10:00
Matt Joiner 21fb4933fc Change the way piece state is exposed to give more detail 2015-06-01 18:22:12 +10:00
Matt Joiner bc4aa06c91 Comments 2015-06-01 18:17:14 +10:00
Matt Joiner 0d13293d71 Support seeding 2015-05-15 08:39:53 +10:00
Matt Joiner c5208569ca Apply sortimports 2015-04-30 00:31:34 +10:00
Matt Joiner 526d9d738e Rewrite imports to local bencode and metainfo 2015-04-27 14:55:01 +10:00
Matt Joiner 28b299e7c8 Rework the Torrent Reader interface, to allow reader options, and add "responsive" as one such option
Had several weeks of testing. Removes a lot of the "helper" reading methods, but this was necessary to allow per-Torrent reading options.
2015-04-14 23:59:41 +10:00
Matt Joiner 60d8ea75a2 Prevent bad metadata_size in extended handshakes from stalling completion of metadata
Occasionally bad peers send ridiculous or incorrect metadata_size in their handshakes. If the first acceptable size is wrong, and too small, we'll keep failing metadata completion. If it's too large, honest peers will never send us the pieces we're asking for and we'll never complete the metadata. Now we just adjust the expected metadata size, and keep retrying until we finish. Additionally, we can now request metadata after sending initial messages.
2015-03-27 15:36:59 +11:00
Matt Joiner 3aa78763aa Use rogpeppe's sortimports to fix this goimports ordering madness 2015-03-26 17:18:08 +11:00
Matt Joiner 842a32ae0c Rewrite import paths for migration from Bitbucket 2015-03-20 16:37:44 +11:00
Matt Joiner 30c67caced Allow some overlap between piece prioritization classes
This probabilistically improves download speeds when doing readaheads
2015-03-20 10:52:55 +11:00
Matt Joiner 466b5f0623 Improve connection status info, especially flags 2015-03-18 18:38:29 +11:00
Matt Joiner a7dddd9be6 Rewrite handshaking and connection management 2015-03-18 18:28:13 +11:00
Matt Joiner 203da0aab0 Tidy up extension bytes handling; don't close conn from handshake writer; force protocol encryption for now 2015-03-13 06:21:13 +11:00
Matt Joiner e85b7e228b Add support for Fast Extension 2015-03-12 20:06:23 +11:00
Matt Joiner 92e0679b04 Change piece prioritization 2015-02-21 15:02:31 +11:00
Matt Joiner ae7261c392 Break active peer status line up 2015-02-10 00:19:56 +11:00
Matt Joiner 2c48152b10 Code comments 2015-01-22 00:42:03 +11:00
Matt Joiner 8e7e551d76 Fix comment 2015-01-11 00:17:25 +11:00
Matt Joiner bcebf569b8 Favour earlier pieces 2015-01-11 00:17:18 +11:00
Matt Joiner d54c5ddf24 Remove a bunch of dead code 2014-12-28 12:51:09 +11:00
Matt Joiner 8d87bb83a6 Refine connection status flags 2014-12-09 00:26:06 -06:00
Matt Joiner a4dc96bb12 Make some overlap of piece priorities
The goal is to reduce duplicating requests on higher priority pieces.
2014-12-06 21:18:17 -06:00
Matt Joiner 3c41002317 Set a low water mark for replenishing requests 2014-12-05 00:58:43 -06:00
Matt Joiner d58ca65a9c pieceordering: Rename RemovePiece->DeletePiece and complete tests
Note that tests currently fail due to bug in skiplist?
2014-12-05 00:58:04 -06:00
Matt Joiner b6ae4caa6a Set priorities ahead of the current read position 2014-12-05 00:56:28 -06:00
Matt Joiner 91c2c1f5c7 Piece priorities, torrent read interface and many fixes 2014-12-03 01:07:50 -06:00
Matt Joiner 7228e40c95 Add piece ordering per-connection piece request priority 2014-12-02 18:22:38 -06:00
Matt Joiner 78ef36066d Give each connection its own piece priority order 2014-12-01 03:36:25 -06:00
Matt Joiner 0f54c2f79e Use a buffer to reduce syscall.Write calls 2014-11-21 00:04:07 -06:00
Matt Joiner e1f720c770 Triage a possible bug blocking while closing UTPConns 2014-11-18 21:53:57 -06:00
Matt Joiner 963918ac90 Add UTP support, disable TCP for now. DHT moves to another port 2014-11-16 13:29:31 -06:00
Matt Joiner c0d7b2fbf2 Rename and improve downloaded chunk counters and status per connection 2014-09-11 20:30:13 +10:00
Matt Joiner aeee372506 Add useful new metrics to connection 2014-08-28 09:32:49 +10:00
Matt Joiner 035edbaf85 Rename connection.closed->closing 2014-08-28 09:31:05 +10:00
Matt Joiner 1ff7414869 Add a counter for optimized cancels 2014-08-24 03:04:07 +10:00
Matt Joiner 95d5d4a30c Improve status and logging 2014-08-22 17:33:17 +10:00