Commit Graph

1543 Commits

Author SHA1 Message Date
Matt Joiner 90ca45dd2d Don't accept pieces with bad indexes
Fixes #132
2016-11-22 14:20:48 +11:00
Matt Joiner 84d243afca Rename connection.downloadedChunk -> receiveChunk 2016-11-22 14:18:09 +11:00
Matt Joiner 6f9bcff8b2 Make downloadedChunk a method of connection 2016-11-22 14:17:30 +11:00
Matt Joiner 0d9348c5d1 Move Client.downloadedChunk to connection.go 2016-11-22 14:16:18 +11:00
Matt Joiner d193dd0479 TODO 2016-11-22 14:01:17 +11:00
Matt Joiner 3602d90b65 gofmt simplify 2016-11-22 14:01:09 +11:00
Matt Joiner 04dedcef9f metainfo: Remove unused import 2016-11-08 21:09:04 +11:00
Vincent 7d327905fe feat: remove print BuildFromFilePath
removes the print of (path, err) in function BuildFromFilePath
2016-11-05 09:56:31 +11:00
Matt Joiner dc7428db54 Reader.Close: Prefer to lock Client in public method 2016-10-31 19:05:33 +11:00
Matt Joiner df60a765a7 Torrent.unpendPieces: Only update unpended pieces
Updating all pieces at once is no longer faster. (There was an optimization for this a while ago that no longer exists.)
2016-10-31 19:05:08 +11:00
Matt Joiner a8e96ce996 When Reader position changes only update piece priorities that may be affected
Seems to significantly reduce CPU load reading from torrents with huge piece counts.
2016-10-31 19:00:08 +11:00
Matt Joiner 95f73db7e4 Ditch the use of generic slices.HeapInterface for finding the worst "bad" connection
It's become a bottleneck. Implement it directly using heap.Interface.
2016-10-31 16:24:48 +11:00
Matt Joiner a49e133d8a Comment on connection.updatePiecePriority
There's also Torrent.updatePiecePriority, and it's always confusing what the difference is.
2016-10-31 16:22:07 +11:00
Matt Joiner 5e83287890 storage: ClientImpl interface now includes Close
This is now necessary because bolt doesn't allow multiple DB handles, so the bolt piece completion DB instance must be at the client level. The new method is not currently used from the Client however, this maybe necessary to avoid leaks.
2016-10-25 20:00:09 +11:00
Matt Joiner 3814a50fa0 storage: Fix spelling mistake 2016-10-25 19:57:35 +11:00
Matt Joiner 27893acf34 storage: Only include sqlite3 piece completion implementation if cgo is enabled
Issue #124.
2016-10-25 19:54:09 +11:00
Matt Joiner 18309b866b storage: Remove sqlite3 import from bolt implementation
#124
2016-10-25 19:52:44 +11:00
Igor Shishkin c43751cfea Trivial HTTP support for adding torrent files by (#126)
* Trivial HTTP support for adding torrent files by

Sometimes it's really usefull to do not download
torrent file locally but simply pass HTTP link
this patch adds such ability.

Signed-off-by: Igor Shishkin <me@teran.ru>

* Fix for closing http connection after use

Signed-off-by: Igor Shishkin <me@teran.ru>
2016-10-25 19:13:06 +11:00
Matt Joiner 5c5a26afed Add bolt piece completion DB
This means it can be persistent without needing cgo. Fixes issues #115 and #124.
2016-10-25 19:07:26 +11:00
Matt Joiner 1725133111 Move the implementation of connection.requestPiecePendingChunks out of Torrent 2016-10-25 14:58:17 +11:00
Matt Joiner 559afcd0a9 Reader.SetReadahead can change readahead pieces 2016-10-24 19:35:12 +11:00
Matt Joiner 0e221dbdcd Optimize piece priorities when reader position changes
Gives a decent boost to throughput and reduces a lot of CPU when reading very quickly from Reader.
2016-10-23 16:33:26 +11:00
Matt Joiner b81913c860 Add TODO item 2016-10-19 01:38:54 +11:00
Thomas Maurice 16ea912b86 Fix not working import 2016-10-15 11:56:15 +11:00
Matt Joiner d4cbdc5c38 Add download rate limiting
Fixes #121.
2016-10-10 17:29:39 +11:00
Matt Joiner ed0dbba384 Make newConnection a method on Client 2016-10-10 16:55:56 +11:00
Matt Joiner c34234bf34 Split connection.rw into separate Reader and Writer
This will make it easier to write hooks for Read and Write separately.
2016-10-10 16:30:51 +11:00
Matt Joiner 099fb9546e Fix Config.UploadRateLimiter comment 2016-10-10 15:03:02 +11:00
Matt Joiner 836bb344f3 Add really simple upload rate limiting and test 2016-10-10 14:58:29 +11:00
Matt Joiner 76c24e70b5 Improve code comments 2016-10-10 14:57:34 +11:00
Matt Joiner 510c03770b Reorder the fields of struct Client 2016-10-10 00:04:14 +11:00
Matt Joiner 44549e7c34 Update README.md
The build status badge is not helpful due to the aggressive testing and badge caching.
2016-10-06 14:58:50 +11:00
Matt Joiner aefc63b9d3 Default to debug mode in client testing config 2016-10-05 15:57:38 +11:00
Matt Joiner de761fb506 Do chunk pooling at Torrent instead of connection level 2016-10-05 15:57:00 +11:00
Matt Joiner d72d93bba7 Speed up mse.handshake.establishS
Remove possible slice allocation, and avoid reflect.
2016-09-30 12:14:34 +10:00
Matt Joiner 47ef753795 peer_protocol.Decoder.Decode: Avoid allocating another intermediate reader
On my system, BenchmarkConnectionMainReadLoop goes from 596 to 1311 MB/s.
2016-09-25 10:31:43 +10:00
Meng Zhuo 23efae91e2 fix unreadable id when started 2016-09-22 12:03:59 +10:00
Meng Zhuo c4979954e8 fix dht-server cmd won't exit after Ctrl+C 2016-09-22 12:03:53 +10:00
Matt Joiner c593366aab Create missing intermediate directories in test 2016-09-21 21:17:22 +10:00
Matt Joiner 3b5f123645 Fix Client.receiveSkeys
Fixes #114. Loop variables in Go are ****ed.
2016-09-21 21:04:52 +10:00
Matt Joiner 0c9c3d35cf Tidy up TestMultipleTorrentsWithEncryption test 2016-09-21 21:02:18 +10:00
Matt Joiner 7856cc6329 Add some more debug logging 2016-09-21 21:00:18 +10:00
Matt Joiner cbeff0a496 Formatting fixes 2016-09-20 18:39:36 +10:00
Matt Joiner 594053609c Fixes for changes to metainfo.MetaInfo.UnmarshalInfo 2016-09-20 18:39:07 +10:00
Matt Joiner b304baad1b Add error return value to metainfo.MetaInfo.UnmarshalInfo
Too many problems caused by bad info bytes in downstream projects.
2016-09-20 12:32:15 +10:00
Michael Howell 9a4fbb01f0 Add a test case for #114 (#117) 2016-09-17 00:01:15 +10:00
Matt Joiner 9126db177b Add Config.{Force,PreferNo}Encryption 2016-09-16 12:42:41 +10:00
Matt Joiner 69f4c5a7e9 Minor comments and test improvement 2016-09-16 12:13:06 +10:00
Matt Joiner 69ffbe6a48 storage: Move sqlite3 import to appropriate file 2016-09-16 11:19:26 +10:00
Matt Joiner 30da5211dd Comment on metainfo.PieceKey 2016-09-16 11:18:36 +10:00