Commit Graph

1612 Commits

Author SHA1 Message Date
Matt Joiner c8dffdbb11 Add test that dirty chunks are cleared on piece hash failure 2016-12-06 15:41:08 +11:00
Matt Joiner 74be3d58e5 Reader.Close: Don’t set t to nil, we may still expect it
For example in goroutines spawned in ReadContext.
2016-12-05 22:00:26 +11:00
Matt Joiner 75b959099f iplist: Begin adding support for parsing CIDR lists 2016-12-01 15:41:52 +11:00
Matt Joiner af7a0d3464 Add Torrent.Closed 2016-11-30 18:02:39 +11:00
Matt Joiner 9d35196cca cmd/torrent: Accept infohash: scheme torrents 2016-11-30 18:02:21 +11:00
Matt Joiner 1f2f037209 Fix logging of trust slice 2016-11-30 18:01:39 +11:00
Matt Joiner 97f6cb496e Avoid deadlock caused by receiving PORT and and DHT announce_peer at the same time 2016-11-28 00:03:10 +11:00
Matt Joiner 8b50f5fa7a Fix deadlock in Client.onDHTAnnouncePeer 2016-11-27 14:43:21 +11:00
Matt Joiner f451a39b69 Fix harmless race conditions in Client.WriteStatus introduced way back 2016-11-27 14:26:45 +11:00
Matt Joiner 79310dd264 dht.NewServer: Initialize the tokenServer 2016-11-27 02:22:47 +11:00
Matt Joiner 4a7fbf6170 Add peers received from received announce_peer DHT messages to the Client
Addresses #133
2016-11-27 00:05:19 +11:00
Matt Joiner 3d043ffc39 dht.Server: Return valid token from get_peers, and handle incoming announce_peer
Addresses #133.
2016-11-26 16:14:37 +11:00
Matt Joiner aa697794cc Remove unused function 2016-11-25 17:24:29 +11:00
Matt Joiner d7416af930 Remove completed TODO item 2016-11-25 17:24:16 +11:00
Matt Joiner fdf75d59c8 Kick only the worst connection when a piece fails a check 2016-11-23 12:59:23 +11:00
Matt Joiner 57b679ffb0 Add a note about dropping connections that we sent a HAVE for incomplete pieces 2016-11-23 11:52:41 +11:00
Matt Joiner 4807c9e29a Make Torrent.conns a map
Can't remember if I've tried this before. But dropping arbitrary connections while iterating established conns will become much simpler.
2016-11-23 11:48:44 +11:00
Matt Joiner ebbd555e7b Move a bunch of Client methods onto more appropriate types 2016-11-22 21:12:53 +11:00
Matt Joiner 389898bb84 tracker: Support the original http response peers format
Fixes #130
2016-11-22 15:40:46 +11:00
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