Commit Graph

3193 Commits

Author SHA1 Message Date
Matt Joiner 1415c0d824 goimports decided to reorganise imports 2014-04-08 19:39:34 +10:00
Matt Joiner a0a715c6f6 Fix calculation of request for torrent data offset 2014-04-08 16:45:33 +10:00
Matt Joiner 9ba3af19ba Break up client.go into several files and a few fixes
Suppress expected errors when initiating connections.
Add an explicit timeout to initiate connections.
Put a lock on closing a connection to prevent data race warnings.
2014-04-03 23:16:59 +11:00
Matt Joiner 8cb39521f2 Fix short read and report unexpected EOFs decoding peer protocol 2014-03-21 00:42:40 +11:00
Matt Joiner 34299483d2 TODO 2014-03-21 00:40:54 +11:00
Matt Joiner 236e12486b Lots of logging improvements 2014-03-21 00:14:17 +11:00
Matt Joiner ef4aa0d3f9 Add -listenAddr and actually listen in ./cmd/torrent 2014-03-21 00:13:32 +11:00
Matt Joiner a1b95d499d Send port on announces when possible 2014-03-21 00:12:53 +11:00
Matt Joiner 1b2a85600f Fix requests to other leechers 2014-03-21 00:11:49 +11:00
Matt Joiner 9e7caacbe3 Tidy up 2014-03-20 22:02:15 +11:00
Matt Joiner a07b53668f Fix races stopping clients and closing connections 2014-03-20 22:01:56 +11:00
Matt Joiner 1c95eda249 Test created torrent structure in current directory 2014-03-20 17:35:11 +11:00
Matt Joiner fa000c4f88 Improvements to pending chunks; extract testutil 2014-03-20 16:58:09 +11:00
Matt Joiner 771a08d4f4 Add a scrape command so I can work out if trackers are seeing my test clients
I don't even know if scrape is the right word.
2014-03-20 04:30:32 +11:00
Matt Joiner 9ee83455cf Various progress, particularly around the way data readiness is handled 2014-03-20 04:30:08 +11:00
Matt Joiner 7e2c384bd5 Fix buffer reuse bug and some formatting. 2014-03-20 01:54:18 +11:00
Matt Joiner 998fbeb0c6 Hunting for goroutine leaks
Start implementing Client.Stop().
2014-03-18 22:39:33 +11:00
Matt Joiner 2e81f914e7 Add a end-to-end test for torrentfs
Basic unchoking and uploading.
Accept incoming connections.
Break out torrentfs lib.
Fix and implement some protocol stuff.
2014-03-18 01:44:22 +11:00
Matt Joiner cbc65ac4c8 Add tracker_test 2014-03-17 02:31:06 +11:00
Matt Joiner 31530899e4 Make use of trackers 2014-03-17 02:30:10 +11:00
Matt Joiner e68d5fec1f Simplify the tracker.New interface, just take a string 2013-12-16 18:47:23 +11:00
Matt Joiner 99d2ced31c Tracker doc 2013-12-16 18:46:55 +11:00
Matt Joiner 5f093c3803 Fixes and tests for UDP tracker protocol 2013-12-14 22:21:45 +11:00
Matt Joiner 8baadf0af3 Fix parsing of UDP announce response peers 2013-12-14 22:20:13 +11:00
Matt Joiner 843c954c09 Implementing UDP tracker in its own module 2013-11-07 01:55:29 +11:00
Matt Joiner c7ca000f25 Unit test for connection address comparison to avoid adding bootstrap peers when already present 2013-11-05 00:10:16 +11:00
Matt Joiner 69c674606f Bring the 'torrent' command up to speed with the client API, including profiling flags 2013-11-05 00:07:28 +11:00
Matt Joiner 495082a60a Set the event condition locker in client
Needed for WaitAll, albeit not actually triggered anywhere yet.
2013-11-05 00:06:40 +11:00
Matt Joiner d7fd5d628b Stop connection writer timer on exit from function 2013-11-05 00:06:08 +11:00
Matt Joiner 068236b6da Remove obsolete private type 'pieceState' 2013-11-05 00:05:44 +11:00
Matt Joiner b499ab3619 Begin on UDP trackers 2013-11-05 00:04:14 +11:00
Matt Joiner 36b36beb3b More explicit implementation for wantPiece method 2013-10-22 18:03:44 +11:00
Matt Joiner ec0ffa84a4 If no requests can be found for a connection, set it to uninterested 2013-10-22 18:03:27 +11:00
Matt Joiner 8f0b076f65 Set pieceByBytesPendingSlice capacity in advance to reduce memory pressure 2013-10-22 18:02:52 +11:00
Matt Joiner fe5f8317d4 Reconnect to the torrentfs -testPeer at regular intervals if it's missing for any loaded torrents 2013-10-22 18:01:56 +11:00
Matt Joiner 8df567e822 Fix keep-alive timer use in connection writer, and make connection a public type
I'm not sure if making this public is the right approach yet, but for now it's a good way to conditionally invoke methods on Client from external packages.
2013-10-22 18:00:35 +11:00
Matt Joiner d039436f55 Significant progress and improvements
Piece state is broken up into several dimensions.
Implement keep-alive in connection writer.
Lazily hash pieces, only as requested.
Replace client actor mechanism with a mutex.
Fix runConnection/connectionLoop/handshake misnomers.
Fix broken reading from partially complete pieces.
2013-10-21 01:07:01 +11:00
Matt Joiner 03b1af07cd Always finish off partially downloaded pieces 2013-10-15 19:42:30 +11:00
Matt Joiner 0a5043ba69 Implement prioritizing of torrent data regions based on FS activity 2013-10-15 01:39:12 +11:00
Matt Joiner 5c0ff3ff5f Torrent client publishes data ready information; torrentfs supports file reads 2013-10-13 23:16:21 +11:00
Matt Joiner 43418e9f65 Fix bugs in the new WriteSectionTo hashing implementation 2013-10-07 18:58:33 +11:00
Matt Joiner a44accadbe Create more efficient writer method for MMapSpan for use with hashing 2013-10-07 10:35:10 +11:00
Matt Joiner e1526b2863 Support browsing torrents in the filesystem 2013-10-07 06:00:35 +11:00
Matt Joiner 8e435ea9e2 Need executable permissions on torrent data directories 2013-10-06 21:12:44 +11:00
Matt Joiner 68e189d477 Start implementing torrentfs binary 2013-10-06 18:01:39 +11:00
Matt Joiner 5dbd675be6 Fix TestHaveEncode now that message length prefixes are actually included in Marshal output 2013-10-06 16:05:03 +11:00
Matt Joiner 4209216696 BEP20 2013-10-02 20:12:05 +10:00
Matt Joiner 39660d4e9d Implement writing of chunks as they arrive 2013-10-02 19:55:03 +10:00
Matt Joiner 381c6bef68 Failing WriteAt should return ErrShortWrite
See the implementation of io.Copy.
2013-10-02 19:54:23 +10:00
Matt Joiner 7bc8524d24 Mostly handle Piece messages, and kick off a piece check when all the chunks are done 2013-10-02 17:57:59 +10:00