Commit Graph

446 Commits

Author SHA1 Message Date
Matt Joiner a1010d7404 Misc tidying 2015-02-10 00:16:01 +11:00
Matt Joiner 029d6939f8 Hide some methods that shouldn't be public 2015-02-10 00:12:29 +11:00
Matt Joiner 4ca6b4e2c7 Fix some stuff Rob Clifford broke through stress testing 2015-02-06 14:54:59 +11:00
Matt Joiner 8e95c1a0ac Log addr when dials fail for unexpected reason 2015-01-31 01:54:45 +11:00
Matt Joiner 4cf28bf0e9 Deduplicate iplist range descriptions, saves another 2.8MB heap 2015-01-31 01:53:42 +11:00
Matt Joiner c6cc38c9cf iplist: Make range descriptions copies of substring, saves 8MB heap on level1 blocklist! 2015-01-31 01:53:01 +11:00
Matt Joiner 336495c25b connectionPruner should terminate when the torrent stops 2015-01-29 14:21:05 +11:00
Matt Joiner b3380f1cee dht: Provide Announce, that combines get_peers and announce_peer 2015-01-29 14:20:21 +11:00
Matt Joiner 04e5880d09 Comments 2015-01-29 14:17:27 +11:00
Matt Joiner 83b9135554 Expose Files from Torrent 2015-01-28 01:12:36 +11:00
Matt Joiner 9995470fe6 Improve returned error 2015-01-22 00:42:13 +11:00
Matt Joiner 78caa4533b Scale readahead with unchoked connections 2015-01-11 00:16:57 +11:00
Matt Joiner ce3fd07fde Set Client.utpSock 2015-01-11 00:16:19 +11:00
Matt Joiner 39b9eb1d37 Switch to my own UTP library 2015-01-08 23:26:39 +11:00
Matt Joiner 0810d5a275 Helper method on Client's Torrent that tells where the metainfo file would be stored 2014-12-30 23:58:38 +11:00
Matt Joiner 7e6b3b24e3 Catch a few possible connection leaks 2014-12-26 17:18:36 +11:00
Matt Joiner cc5dea6a39 Reenable UTP despite it being broken, some binaries now have flags to disable it 2014-12-26 17:18:15 +11:00
Matt Joiner 9b0e387ac9 Quieten tracker announce logging 2014-12-26 17:17:49 +11:00
Matt Joiner 3a221dc57d Rip out the pieces by bytes left and responsive download strategy stuff 2014-12-26 17:15:17 +11:00
Matt Joiner c817776fda Don't include active handshakes in the half open limit
Large numbers of incoming connections choke initiation of outbound conns.
2014-12-23 15:20:28 +11:00
Matt Joiner e406d74ff0 Don't guess cap for some torrent fields, need to minimize memory use 2014-12-20 13:00:21 +11:00
Matt Joiner 262f045fd1 Fixes due to not pending chunk specs prematurely 2014-12-09 00:22:05 -06:00
Matt Joiner 48582796ed Add pending peers high water mark to stop excessively long running DHT queries 2014-12-08 21:58:49 -06:00
Matt Joiner 4be7b11a3b Use bitbucket.org/anacrolix/sync 2014-12-08 17:00:38 -06:00
Matt Joiner d9793a78ba Improve announce logging 2014-12-08 16:57:42 -06:00
Matt Joiner 1e3a00979d Fix UTP still listening despite attempting to temporarily disable it 2014-12-06 21:19:56 -06:00
Matt Joiner 51306ccbb2 Expose various DHT state 2014-12-06 21:19:02 -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 65ccc9c75e Forgot to commit this part of fixing disable TCP dialing out 2014-12-05 00:56:51 -06:00
Matt Joiner b6ae4caa6a Set priorities ahead of the current read position 2014-12-05 00:56:28 -06:00
Matt Joiner f050bc02f7 Disabling TCP didn't include dialing out, also always disable UTP until the package is fixed 2014-12-05 00:53:26 -06:00
Matt Joiner 7b46b41011 Switch back to using the UTP redesign 2014-12-03 19:58:02 -06:00
Matt Joiner 91c2c1f5c7 Piece priorities, torrent read interface and many fixes 2014-12-03 01:07:50 -06:00
Matt Joiner 98400ab9c7 Harmless shortcut initing peer pieces when we have the torrent info 2014-12-02 18:43:05 -06:00
Matt Joiner a87e753572 When metadata arrives, we also need to init request ordering 2014-12-02 18:42:22 -06:00
Matt Joiner 9fac3e8f33 Remove commented out code 2014-12-02 18:23:07 -06:00
Matt Joiner 7228e40c95 Add piece ordering per-connection piece request priority 2014-12-02 18:22:38 -06:00
Matt Joiner c75f79b097 Speed up tests, allow -short for some UDP tracker stuff 2014-12-02 14:23:01 -06:00
Matt Joiner e7dec6057b Backed out changeset: 603a76a6bdb0 2014-12-02 00:11:39 -06:00
Matt Joiner 351bc3e504 Update to use utp package redesign 2014-12-01 23:35:39 -06:00
Matt Joiner d599f85391 Ensure that when a cached torrent is used, the info hash is correct 2014-12-01 23:32:40 -06:00
Matt Joiner 0f1342d7d1 Don't clobber torrent name with empty magnet display name 2014-12-01 19:12:03 -06:00
Matt Joiner 0a91eef496 For now always read ahead 4 extra blocks 2014-12-01 17:02:31 -06:00
Matt Joiner e4f1f5d55e Rework torrent adding 2014-12-01 16:40:03 -06:00
Matt Joiner 362dfecbf2 Support banning torrents 2014-12-01 16:39:09 -06:00
Matt Joiner fb2b626175 Don't send constructed MetaInfo down a channel when it's available, build it on demand 2014-12-01 16:37:40 -06:00
Matt Joiner 709650c0bd Sleep between announces in case there are no trackers 2014-12-01 12:43:34 -06:00
Matt Joiner 75cde79d65 Improve the interface with client and download strategies 2014-12-01 03:37:33 -06:00
Matt Joiner 78ef36066d Give each connection its own piece priority order 2014-12-01 03:36:25 -06:00
Matt Joiner 0a71fe4bee Fast start torrent tracker announces 2014-12-01 03:33:52 -06:00
Matt Joiner 76f83e60b2 Misc good fixes 2014-12-01 03:32:17 -06:00
Matt Joiner 54ea32ddc4 Block IPv6 for now 2014-12-01 03:27:11 -06:00
Matt Joiner 336715874f Fix race reordering tracker tier 2014-11-29 20:33:45 -06:00
Matt Joiner d68664d6c8 Some changes to block list handling 2014-11-29 20:33:17 -06:00
Matt Joiner 0eb36e76ef A few tweaks 2014-11-28 19:42:18 -06:00
Matt Joiner 17a8b8aa17 Make use of IP blocklist and change the client lock to RWMutex
The blocklist is loaded through from the file at TORRENT_BLOCKLIST_FILE or
$HOME/.config/torrent/blocklist.
2014-11-28 19:41:53 -06:00
Matt Joiner 50e3db173f Allow DHT server config to be passed through when creating a new client 2014-11-28 12:13:08 -06:00
Matt Joiner c10fbb2022 Extra time between tracker announces 2014-11-28 08:39:13 -06:00
Matt Joiner 1527321c71 Wasn't actually copying the tiers
http://stackoverflow.com/questions/27055626/concisely-deep-copy-a-slice
2014-11-21 00:54:19 -06:00
Matt Joiner 97074dc060 Improve tracker connect error log message 2014-11-21 00:32:39 -06:00
Matt Joiner 4725a70875 Shuffle tracker tiers after adding trackers 2014-11-21 00:32:27 -06:00
Matt Joiner 1a401e82f5 Merge trackers by magnet links if the torrent is already present 2014-11-21 00:10:52 -06:00
Matt Joiner 06aff91f8c Don't open new connections or announce when new connections aren't wanted 2014-11-21 00:09:55 -06:00
Matt Joiner 1942d5b73b Fix default torrent client address, and leaked resources 2014-11-21 00:07:04 -06:00
Matt Joiner c57ea76b88 Support disabling UTP 2014-11-19 20:02:20 -06:00
Matt Joiner dd240b66c4 Simple connection pruner 2014-11-18 22:03:21 -06:00
Matt Joiner eacc624115 Expose a Torrent "handle", that implements ReaderAt 2014-11-18 21:58:36 -06:00
Matt Joiner c8327a8fe2 Log bad metadata packets instead of crashing 2014-11-18 21:57:27 -06:00
Matt Joiner 3dd43c6099 buffer WriteStatus and always write torrents in the same order 2014-11-18 21:56:50 -06:00
Matt Joiner 358f089515 Set a minimum dial timeout 2014-11-18 21:53:00 -06:00
Matt Joiner 1057ac8055 Adding a duplicate magnet returns the existing torrent 2014-11-18 14:34:13 -06:00
Matt Joiner 482dde8e3f Fix race condition calculating reduced dial timeout 2014-11-18 14:33:07 -06:00
Matt Joiner c63d36c1b6 Improve client status write-out 2014-11-18 14:32:51 -06:00
Matt Joiner abfa44d6e4 Count accepted connections 2014-11-18 14:31:47 -06:00
Matt Joiner 541f11aed4 Ensure the parallel dial invariant 2014-11-17 18:04:33 -06:00
Matt Joiner 8cae78cbf1 Reduce dial timeouts when there are lots of peers in the backlog 2014-11-17 18:04:09 -06:00
Matt Joiner 6d05994c2c dht: Include the sender of peers in the peer stream 2014-11-17 17:47:36 -06:00
Matt Joiner 727aac204f Expvar successful and unsuccessful dials 2014-11-17 01:44:06 -06:00
Matt Joiner 8d96195b0c Connect to peers using both UTP and TCP; Share UTP port with DHT 2014-11-16 23:27:01 -06:00
Matt Joiner ad7cf646c8 Open new connections when a connection is dropped 2014-11-16 21:37:34 -06:00
Matt Joiner 34a47a100e Add util AddrIP and AddrPort functions 2014-11-16 21:20:49 -06:00
Matt Joiner 77e064a0f5 Allow the client ID to be set in the config 2014-11-16 13:54:43 -06:00
Matt Joiner c1721b61ef Prevent clients from connecting to other clients with the same ID 2014-11-16 13:54:00 -06:00
Matt Joiner 3489a60154 Fix broken commit 2014-11-16 13:51:59 -06:00
Matt Joiner 4fead22cd2 Use more generic net error type to detect timeouts 2014-11-16 13:31:11 -06:00
Matt Joiner e37d369864 Move half-open tracking into per-torrent 2014-11-16 13:30:44 -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 eeae2d3285 Actually announce to DHT, don't just get peers 2014-11-16 13:18:08 -06:00
Matt Joiner 86de81fba8 Tidy up address handling 2014-11-16 13:16:26 -06:00
Matt Joiner ecf2639856 Add magnet-metainfo, tool to download magnet to torrent file 2014-09-25 18:05:52 +10:00
Matt Joiner 6942eed15f Lazily hash pieces where possible 2014-09-15 03:25:53 +10:00
Matt Joiner 7eaef48f9e Fix crash when piece hash completes for dropped torrent 2014-09-14 04:07:05 +10:00
Matt Joiner 1cfd6ecdcb Improvements arising from attempting to delay piece hashing until necessary 2014-09-14 04:03:23 +10:00
Matt Joiner 979192cbfd Treat PORT messages with port of 0 to mean on the remote port 2014-09-14 03:59:31 +10:00
Matt Joiner bea5c1a502 Missed this dataRead call in an earlier commit 2014-09-14 03:58:13 +10:00
Matt Joiner dc2b622be1 Track failed piece hashes 2014-09-14 03:57:51 +10:00
Matt Joiner 97ae59dfaf Improve the data waiter system 2014-09-14 03:50:15 +10:00
Matt Joiner 4bcfdc8fc9 Suppress metadata extension message errors from Xunlei client 2014-09-14 03:47:47 +10:00
Matt Joiner f2bb5b1c56 Increase peer connection buffer size from default (4096) to 20KiB
This reduces syscall overhead which becoming noticeable.
2014-09-14 03:47:06 +10:00
Matt Joiner 7fccb77ebe Treat ECONNRESET and i/o timeout from peers as EOF 2014-09-14 03:45:38 +10:00
Matt Joiner c0d7b2fbf2 Rename and improve downloaded chunk counters and status per connection 2014-09-11 20:30:13 +10:00
Matt Joiner 2b360b641c Don't log extension message parsing errors from -SD0100- 2014-09-11 14:20:47 +10:00
Matt Joiner 689fe85134 Disable TCP linger for peer connections 2014-08-28 10:06:57 +10:00
Matt Joiner ed08bd2837 Introduce socket/torrent limits, work in progress 2014-08-28 10:06:36 +10:00
Matt Joiner d5a2bc67f7 Misc tweaks 2014-08-28 10:05:41 +10:00
Matt Joiner e09e21fab2 Fixes to closing torrents and connections 2014-08-28 10:04:44 +10:00
Matt Joiner 7e19c9c12b Forgot to commit duplicateConnsAvoided expvar 2014-08-28 09:45:58 +10:00
Matt Joiner e79f1bcbf7 Keep track of ongoing handshakes and add timeouts to connection sockets 2014-08-28 09:45:20 +10:00
Matt Joiner c33b889b5e Cease networking on a torrent if it's finished and we're not going to seed 2014-08-28 09:39:27 +10:00
Matt Joiner 2765ad04ca Avoid connecting to the same peer twice by address 2014-08-28 09:35: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 2d9c22ae1e Misc trivial improvements 2014-08-25 22:14:10 +10:00
Matt Joiner 891745360e Add a date to the metadata packet client version string 2014-08-25 22:12:50 +10:00
Matt Joiner c9bc892789 Implement the DHT Port message 2014-08-25 22:12:16 +10:00
Matt Joiner 6aa459dc0d Stop announcing on DHT if a torrent is removed 2014-08-25 06:01:05 +10:00
Matt Joiner 78ed2c74d0 Make NoUpload a client configuration option and use it for torrentfs 2014-08-25 06:00:29 +10:00
Matt Joiner c8f335182f Improve incomplete piece ordering, responsive download strategy 2014-08-25 05:31:34 +10:00
Matt Joiner 8f89d7a07e Use CopyExact when extracting handshake read 2014-08-25 05:25:52 +10:00
Matt Joiner 0b01c597c0 Let client.DataWaiter have its own mutex 2014-08-25 05:24:18 +10:00
Matt Joiner 8db966cd42 Make use of levelmu to prioritize client.TorrentReadAt 2014-08-25 05:23:28 +10:00
Matt Joiner 8f065e473f Add some checks to TorrentReadAt for 0 byte reads 2014-08-24 06:54:14 +10:00
Matt Joiner b72b05f495 Count posted cancels 2014-08-24 03:10:47 +10:00
Matt Joiner 2b079e4a9d Got a nice working algorithm for responsive download strategy 2014-08-24 03:08:11 +10:00
Matt Joiner c1896c4d46 Count unexpected cancels received 2014-08-22 17:47:44 +10:00
Matt Joiner 95d5d4a30c Improve status and logging 2014-08-22 17:33:17 +10:00
Matt Joiner edf0a13128 Export some log events via expvar instead 2014-08-22 01:33:13 +10:00
Matt Joiner 702665f9f3 Remove torrent from download strategy when dropped 2014-08-22 01:25:18 +10:00
Matt Joiner e8f184a7bf Store pending peers in a dict to prevent duplicates 2014-08-21 21:10:19 +10:00
Matt Joiner 5c1492bffe Add CopyExact util function 2014-08-21 18:24:19 +10:00
Matt Joiner 52fc7c7205 Improve the internal connection and handshake logic 2014-08-21 18:12:49 +10:00
Matt Joiner 40fd1d647c Tidy up the torrent and DHT APIs 2014-08-21 18:07:06 +10:00
Matt Joiner 466c85a1b2 Triage upload contention due to lack of uploader routine 2014-07-24 13:46:49 +10:00
Matt Joiner 3a852886ad Triage announcer leak on dropped torrents 2014-07-24 13:46:14 +10:00
Matt Joiner 9895205e19 Comments and logging 2014-07-24 13:43:45 +10:00
Matt Joiner ec1c4b0cf8 Improve client status 2014-07-24 13:43:11 +10:00
Matt Joiner ef7c4f4120 Move priority management entirely into the download strategies 2014-07-24 13:42:31 +10:00
Matt Joiner 6158b1f6ec torrentfs: Match the active torrents to those found in the given directory 2014-07-23 01:54:11 +10:00
Matt Joiner 6d52918540 Fix missed unlock adding peers to non-existent torrent 2014-07-23 01:51:30 +10:00
Matt Joiner 3ae290fef6 Fix crash printing client status if DHT isn't enabled 2014-07-23 01:50:49 +10:00
Matt Joiner 244c70bc83 Implement "yourip" field of extension protocol handshake 2014-07-22 21:45:12 +10:00
Matt Joiner 7f6987b2a4 Error in connection.writer goroutine wasn't killing the connection 2014-07-18 02:37:33 +10:00
Matt Joiner 37eece626b TODO 2014-07-17 16:04:56 +10:00
Matt Joiner b467f15bae Fix goroutine leak for connection.writer 2014-07-17 16:02:30 +10:00
Matt Joiner a258b9ab21 Squash some more debug messages, fix some other error handling 2014-07-17 16:01:48 +10:00
Matt Joiner b159968081 Missing newline between torrents in client status 2014-07-17 15:58:33 +10:00
Matt Joiner 5cda3affb4 Memory leak because queued peer requests aren't treated yet 2014-07-16 17:08:47 +10:00
Matt Joiner 583d5c266a Squash some unhelpful log messages now that stuff is available in status 2014-07-16 17:08:25 +10:00
Matt Joiner 8910eb660d Add more information I've needed to the status page 2014-07-16 17:07:28 +10:00
Matt Joiner 0d27ae7fd1 Make the discovery source for a connection more descriptive 2014-07-16 17:06:18 +10:00
Matt Joiner 9e8a72ff1d Invalidating metadata would cause a crash when metadata pieces kept arriving 2014-07-14 23:12:52 +10:00
Matt Joiner 61b87222d4 Client would attempt to download if unchoked before the metadata is available 2014-07-14 23:12:15 +10:00
Matt Joiner 28afa748e7 API changes in github.com/anacrolix/libtorgo 2014-07-13 17:37:12 +10:00
Matt Joiner 581a3d9325 Add DHT support to cmd/torrent 2014-07-11 19:30:20 +10:00
Matt Joiner e947ce2ee4 Run go vet on everything 2014-07-10 02:59:37 +10:00
Matt Joiner a88f856468 Fix incorrect log call
At least vet catches it...
2014-07-10 02:53:46 +10:00
Matt Joiner 4c2d07337d Keep pieces sorted by bytes left 2014-07-10 00:26:58 +10:00
Matt Joiner ae45175015 Fix crash quitting when accept conn is closed 2014-07-04 01:44:15 +10:00
Matt Joiner 8505a1017e Move compactPeers type to util package 2014-07-04 01:41:46 +10:00
Matt Joiner 0f53e89e7b Improve some log messages 2014-07-01 00:05:28 +10:00
Matt Joiner 23cfe49ea4 Record if a connection was incoming 2014-07-01 00:04:28 +10:00
Matt Joiner b969b17092 Disable request heat assertion for now
Probably want a flag to do intensive checks like this
2014-06-30 00:22:36 +10:00
Matt Joiner eb070383b1 Move download strategies into their own file 2014-06-30 00:22:05 +10:00
Matt Joiner 51431c7cfc Some minor tweaks 2014-06-29 19:10:59 +10:00
Matt Joiner b87bb74f31 Fix a race where the last piece of a torrent is requested before it's been hashed 2014-06-29 19:08:16 +10:00
Matt Joiner 3b29043861 Add peers sent over PEX 2014-06-29 19:07:43 +10:00
Matt Joiner aec5074f3d Add support for extended handshake "v", "reqq", and "p" fields 2014-06-29 18:57:49 +10:00
Matt Joiner 5e7fe0383b Fix crash printing client status when a torrent info isn't available 2014-06-29 18:56:19 +10:00
Matt Joiner 434c954319 Log errors setting the metadata for a torrent, and report when metadata is completed from peers 2014-06-29 15:45:21 +10:00
Matt Joiner 87100587f8 Remove some metadata related debug messages 2014-06-29 15:44:55 +10:00
Matt Joiner c96293a111 Can now download from magnet links 2014-06-28 19:38:31 +10:00
Matt Joiner 9d53e19547 Fixes for cmd/torrent with the new torrent.Info field 2014-06-27 18:57:35 +10:00
Matt Joiner 49e71f9654 Begin adding magnet and ut_metadata support 2014-06-27 00:57:07 +10:00
Matt Joiner 33d53cf9e5 Trivial fix for one of the last commits 2014-06-26 18:08:14 +10:00
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