Commit Graph

172 Commits

Author SHA1 Message Date
Matt Joiner 7c532969d3 Various improvements that've had a lot of testing 2014-06-26 18:06:33 +10:00
Matt Joiner de769cdce7 vet some printfs 2014-06-26 17:30:16 +10:00
Matt Joiner cf31465904 torrentfs: Write client status to HTTP port 2014-06-26 17:29:12 +10:00
Matt Joiner 9b6e3f25cd Reorder actions after a chunk is received 2014-05-29 02:44:27 +10:00
Matt Joiner 26116a7df8 Shuffle chunk spec request order for readahead pieces
Should reduce overlap in received chunks.
2014-05-29 01:32:34 +10:00
Matt Joiner 110aa733a4 Make the readahead on ResponsiveDownloadStrategy customizable 2014-05-29 01:30:59 +10:00
Matt Joiner cfc282ff51 Remove requests from the outbound message queue if cancelled before they're written
Only post peer protocol messages to the channel, bytes must be done directly.
This fixes a possible issue where slow responses during handshake could cause
keep alive messages to be sent prematurely.
2014-05-29 01:27:48 +10:00
Matt Joiner f455ee3868 Remove redundant replenishConnRequests when receiving unchoke 2014-05-23 21:02:42 +10:00
Matt Joiner dfde2a3497 dat new-world-style panic 2014-05-23 21:02:11 +10:00
Matt Joiner 91bf870eb1 Fix a race checking bytes left when announcing 2014-05-23 21:01:35 +10:00
Matt Joiner 898c4f4e4f Store request heat in the download strategy
This avoids recalculating it for every FillRequest
2014-05-23 21:01:05 +10:00
Matt Joiner 763e387c62 TorrentReadAt shouldn't care about verification state 2014-05-23 00:37:36 +10:00
Matt Joiner 65fa317244 Some minor fiddling to announcing in the client 2014-05-23 00:35:24 +10:00
Matt Joiner 96f85be99a ResponsiveDownloadStrategy will readahead blocks
Test peers don't play well with short "up request" buffers, so we need to fill
these with the most likely blocks to achieve maximum download speeds.
2014-05-23 00:33:07 +10:00
Matt Joiner 8022c09b90 client.go: Shorten module peer_protocol to pp 2014-05-21 18:01:58 +10:00
Matt Joiner fdcee11eb0 Shorten variable names in connectionLoop 2014-05-21 17:55:50 +10:00
Matt Joiner cc81bca617 Be more selective about when to replenish connection requests 2014-05-21 17:49:59 +10:00
Matt Joiner 309f70bcb5 Implement connection.{Cancel,Choke} 2014-05-21 17:49:28 +10:00
Matt Joiner ef9e334479 Allocate peer_protocol.Message on the stack in connectionLoop 2014-05-21 17:48:44 +10:00
Matt Joiner d16f444fa8 Support individual peer max requests 2014-05-21 17:47:42 +10:00
Matt Joiner ec77cb0ece Misc minor improvements 2014-05-21 17:42:06 +10:00
Matt Joiner 04879b0002 Add Client.DownloadStrategy; fix priority of incomplete pieces 2014-05-21 17:40:54 +10:00
Matt Joiner 99b7ef4e42 Ininitialize the torrent.Priorities up front and do initial piece checks with a single goroutine 2014-05-21 17:37:31 +10:00
Matt Joiner 0f3c4cb3ec Add some String methods and contextual information in log messages 2014-05-21 00:52:49 +10:00
Matt Joiner 0dee5d9952 Make Request private 2014-04-16 21:13:44 +10:00
Matt Joiner 036fd126e8 Implement receiving cancel messages 2014-04-16 17:33:33 +10:00
Matt Joiner 1aa1063863 Big visibility/doc clean-up, and extract mmap_span package 2014-04-09 02:36:05 +10:00
Matt Joiner 786952e4cd Add error handling to PrioritizeDataRegion as it's public facing API 2014-04-09 01:15:39 +10:00
Matt Joiner c1bf4de70f Mask EHOSTUNREACH on connect() 2014-04-08 19:40:10 +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 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 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 a07b53668f Fix races stopping clients and closing connections 2014-03-20 22:01:56 +11:00
Matt Joiner fa000c4f88 Improvements to pending chunks; extract testutil 2014-03-20 16:58:09 +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 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 31530899e4 Make use of trackers 2014-03-17 02:30:10 +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 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 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 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 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
Matt Joiner 28531a4fcc Fix request/chunk confusion, missing outgoing message prefix, protocol tests; improve request triggering 2013-10-01 18:43:18 +10:00
Matt Joiner 081a6805c5 Implementing bitfields and connection message handling 2013-09-30 21:51:08 +10:00
Matt Joiner abf5c92488 Implement peer connection writer, optimizer and handshake 2013-09-29 16:45:17 +10:00
Matt Joiner 28c7c6a5d7 Fix race conditions 2013-09-29 16:44:37 +10:00
Matt Joiner fe80bf2f2f BytesInfoHash wasn't actually initializing the info hash 2013-09-29 16:43:35 +10:00
Matt Joiner 978aa1f0c8 Don't rely on *os.File finalizer for close 2013-09-29 14:20:18 +10:00
Matt Joiner ac254e95f2 Prevent false-positive race conditions 2013-09-29 14:18:43 +10:00
Matt Joiner 7870d20573 Begin implementing the adding of peers, and initiating of connections 2013-09-29 08:11:24 +10:00
Matt Joiner ddd4382474 Handle actorTask messages 2013-09-29 04:05:09 +10:00
Matt Joiner 805897afb5 Can't send to torrentFinished while handling an event 2013-09-29 04:04:46 +10:00
Matt Joiner b4989a370f Fix crash due to torrent.MetaInfo being unset 2013-09-29 04:03:36 +10:00
Matt Joiner aefe754698 Create torrent data files with at least the required size
Truncate is required or use of mmap'd region beyond file length raises SIGBUS.
2013-09-29 04:03:04 +10:00
Matt Joiner 816c263760 Start implementing a basic client 2013-09-26 19:49:15 +10:00