2
0
mirror of synced 2025-02-24 22:58:28 +00:00

59 Commits

Author SHA1 Message Date
Matt Joiner
898e878c69 Aggressively wake Readers 2018-02-04 22:47:01 +11:00
Matt Joiner
eb448d132d Update context imports 2018-01-31 16:42:26 +11:00
Matt Joiner
692facdebb Add TODO 2018-01-25 17:43:33 +11:00
Matt Joiner
52524925d2 Add separate piece priorities, and cache pending pieces
Should fix a bug where prioritizing files is not alone sufficient to trigger downloading.
2018-01-25 17:18:36 +11:00
Denis
aa42704976 fixing wrong offset in request (#226) 2018-01-08 11:03:34 +11:00
Matt Joiner
9626134211 File.offset wasn't applied to the reads on the Torrent 2018-01-07 19:26:24 +11:00
Matt Joiner
87a033e074 Readers obtained from File.NewReader should not readahead into other Files
Fixes #221. Additionally Torrent.length is a pointer and isn't set until the info is available to avoid it defaulting to zero.
2018-01-06 23:15:41 +11:00
Matt Joiner
23363506f5 Reader: Changing responsiveness should wake blocked reads 2018-01-06 16:40:35 +11:00
Matt Joiner
9b718566ba Add File.NewReader
Fixes #222
2018-01-06 16:37:13 +11:00
Matt Joiner
b9a1cb5b8b missinggo.LimitLen changed 2017-12-03 13:44:08 +11:00
Matt Joiner
9757f04cf8 Apply megacheck to torrent package 2017-11-07 16:11:59 +11:00
Matt Joiner
0388ec1eee Synchronize Torrent.Info 2017-08-29 15:16:53 +10:00
Matt Joiner
7d55f573f5 Maintain a torrent.Reader for each file handle
This means that readahead will work much better. Addresses https://github.com/anacrolix/torrent/issues/182.
2017-08-28 01:42:02 +10:00
Matt Joiner
a8a1ea755d Remove unused functions 2017-08-26 13:23:04 +10:00
Matt Joiner
824441efa0 Move logging inside client lock, for Torrent.String
Fixes #163
2017-07-01 16:01:38 +10:00
Denis Kuzmenok
8cae956528 added few helper functions: t.PieceBytesMissing, r.CurrentPos, r.SetNonResponsive 2017-06-02 07:46:28 +03:00
Matt Joiner
1d54b1c6d8 Massively reduce CPU when Readers are blocked on unavailable data 2017-02-01 16:28:16 +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
dc7428db54 Reader.Close: Prefer to lock Client in public method 2016-10-31 19:05:33 +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
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
8b17d2a63a Rework Reader position changes affecting piece priorities
Torrent.updatePiecePriorities is always followed by Torrent.piecePriorityChanged, so move it into the former function. Also drop the separate mutex for Reader, and add a missing Reader.posChanged call.
2016-08-30 15:41:26 +10:00
Matt Joiner
9943fc3c58 Improve the log message when piece reads fail 2016-07-10 23:01:17 +10:00
Matt Joiner
363f042b95 Piece offset computed incorrectly in Reader.readOnceAt
Possibly it was only wrong on the last piece in rare circumstances.
2016-07-10 23:00:52 +10:00
Matt Joiner
c6db777ed4 Bring back log message when a piece read fails unexpectedly 2016-07-10 14:00:25 +10:00
Matt Joiner
528836ab4c Get rid of obsoleted Torrent.ceaseNetworking, and clean up Torrent.closing 2016-05-11 21:44:55 +10:00
Matt Joiner
d2fa0e814d Ugh, "context" isn't in go 1.6 2016-04-30 11:33:07 +10:00
Matt Joiner
f62ff2f540 Add Reader.ReadContext
Allows cancelling reads etc. Torrents that get stuck can result in Reads that won't return until the torrent is dropped.
2016-04-30 11:08:29 +10:00
Matt Joiner
d3a1c79c79 Merge Torrent and torrent types 2016-04-03 18:40:43 +10:00
Matt Joiner
08830b97a1 Make everything on type torrent private 2016-04-03 16:50:53 +10:00
Matt Joiner
6a8bbc4e14 Suppress piece read errors when data is obtained 2016-04-03 16:35:28 +10:00
Matt Joiner
4c3fffa097 Fix locks on Reader.SetReadahead 2016-03-19 17:39:56 +11:00
Matt Joiner
aed2b6b3cb Add Reader.Torrent() 2016-03-02 23:26:46 +11:00
Matt Joiner
5cfa8232ed Fix races in Reader 2016-02-22 02:42:01 +11:00
Matt Joiner
c184129865 Update Reader pos between reads 2016-02-22 00:32:02 +11:00
Matt Joiner
5b443fb63d Refresh all piece completion states when data is missing 2016-02-21 17:24:59 +11:00
Matt Joiner
400fa1feaf Fix race updating piece priority when piece being read is unexpectedly unavailable 2016-02-21 03:33:39 +11:00
Matt Joiner
e20858a1e8 Move dataReadAt to torrent.readAt, and do the waitNoPendingWrites check there 2016-02-21 03:32:59 +11:00
Matt Joiner
89ec237769 Improve log message 2016-02-20 14:40:55 +11:00
Matt Joiner
dcce061152 Rework Reader reading, and TestCompletedPieceWrongSize 2016-02-17 18:26:10 +11:00
Matt Joiner
afa264e6c5 Reintroduce connection piece inclinations, and begin caching piece priorities 2016-02-01 21:11:41 +11:00
Matt Joiner
9e50da4892 Fix stall if data goes missing during a read 2016-01-28 13:21:50 +11:00
Matt Joiner
90348f6a48 Add pending write helpers 2016-01-25 07:22:33 +11:00
Matt Joiner
06445f2a1e It's working and the tests are usually passing
I still need to handle "prefetch"-style downloading, and some functions haven't been committed to force this issue.
2016-01-18 18:35:14 +11:00
Matt Joiner
89a6a20af6 Finally make Torrent.torrent private
A lot of code was using unintentionally exported stuff from the embedded *torrent in Torrent.
2016-01-17 00:14:15 +11:00
Matt Joiner
153c13db43 Revert "Merge pull request #54 from zhulik/master"
This reverts commit 5cf75b869c469196a8473c4962b99a450daaeeec, reversing
changes made to 09050ff2c5607f3991e6ec6422ed57ba0dee0bad.
2016-01-06 12:19:49 +11:00
Gleb Sinyavsky
48c3df2d43 Refactorings 2016-01-05 11:48:16 +03:00
Matt Joiner
bc5d79e1d3 Make torrent.Reader reads fail when the torrent is closed instead of stalling 2015-11-06 00:40:47 +11:00
Matt Joiner
d01c6221e6 Remove sync.Cond from piece
It's not trivial to ensure that anyone waiting on the piece Cond will wake on events like the torrent being dropped from the client.
2015-11-06 00:40:16 +11:00