Commit Graph

88 Commits

Author SHA1 Message Date
Matt Joiner e8b496bee6 Add default sqrt readahead algorithm 2021-09-09 22:19:48 +10:00
Matt Joiner 4912ae2781 Extract common Torrent.newReader 2021-09-09 22:19:48 +10:00
YenForYang cce8c150c2 PieceStateRuns: reduce copying and make inlineable
Just a heads up: using `range` and/or `defer` prevents function inlining. This is fine for infrequently called functions and/or large functions, but for simple public methods like these, I'd assume it's better for them to be inlined.
2021-09-01 14:51:45 +10:00
Matt Joiner e04c9a13f1 Precompute File.DisplayPath
This is an optimization for dir lookups in torrentfs.
2021-08-01 22:01:24 +10:00
Matt Joiner 4ab20f60b6 Improve some lock handling under panics 2021-05-14 15:36:53 +10:00
Matt Joiner c81da2d5ee Strictly adher to tracker announce response intervals if a torrent is private 2020-12-09 22:36:57 +11:00
Matt Joiner cb37a914c1 Rename Peer to PeerInfo, and unexport PeerInfos 2020-05-29 19:44:48 +10:00
Matt Joiner 2f3d41765b Fix race in Torrent.PeerConns 2020-04-16 17:21:15 +10:00
Matt Joiner c2210c058c Fix pending peer counts in transfer tests
Also expose number of peers successfully added in some method returns.
2020-04-16 14:09:45 +10:00
Matt Joiner ea71bf770c Expose PieceStateRun formatting 2020-02-27 16:42:33 +11:00
Matt Joiner c855c7a366 Differentiate between storage.ClientImpl{,Closer} 2020-02-21 14:12:44 +11:00
Matt Joiner dff436f102 Rename connection->PeerConn and fix exports 2020-02-21 11:07:50 +11:00
Matt Joiner 4104880a66 Remove unnecessary locking in Torrent.Piece 2019-12-18 16:49:15 +11:00
Yates 790ba6af3c use path.utf8 first for some torrent (#350) 2019-12-08 20:35:40 +11:00
Matt Joiner cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner 499b2d8725 Fix race condition in Torrent.SetDisplayName 2019-03-20 11:01:56 +11:00
Matt Joiner 3920c6c325 Fix race in Torrent.String 2019-03-12 11:22:25 +11:00
Matt Joiner 9ea65d672f Torrent.String: Quote raw names 2019-02-16 18:33:14 +11:00
Matt Joiner 366ead7d65 Switch to Client read locks for a few methods 2019-01-08 15:46:03 +11:00
Matt Joiner fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11:00
Matt Joiner 6dd3b9c12c Law of Demeter Client.mu 2018-07-25 13:42:28 +10:00
Matt Joiner f5bd377941 Change pieceIndex to peer_protocol.Integer 2018-07-12 09:15:15 +10:00
Matt Joiner a1fabaf2f8 Improve Torrent.DownloadPieces documentation
Was mentioned in Gitter.
2018-05-18 14:06:28 +10:00
Matt Joiner 37272a391b Avoid race in test 2018-01-27 14:31:46 +11:00
Matt Joiner 8c6d0440c2 Improve Torrent.BytesCompleted comment 2018-01-27 14:31:46 +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
Matt Joiner 0b553b296f Add File priorities
Fixes #220.
2018-01-21 22:49:12 +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 9b718566ba Add File.NewReader
Fixes #222
2018-01-06 16:37:13 +11:00
Matt Joiner b3137b1ede Make type piece public 2017-09-15 19:35:16 +10:00
Matt Joiner 2aa20b3e22 Don't verify data at startup, add Torrent.Piece.VerifyData and Torrent.VerifyData for this purpose
This has the side effect of deflaking a lot of tests that race to verify data when a torrent is added.
2017-09-15 19:22:32 +10:00
Matt Joiner 0388ec1eee Synchronize Torrent.Info 2017-08-29 15:16:53 +10:00
Matt Joiner cd20c2df36 Fix handling of infohash as hex in Torrent.String 2017-07-01 16:02:06 +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 a959bdd0f8 Revert "Quick fix for missing MetaInfo.Announce everywhere with trackers"
This reverts commit b7a8d08bbf.
2017-02-15 18:40:30 +11:00
Matt Joiner b7a8d08bbf Quick fix for missing MetaInfo.Announce everywhere with trackers 2017-02-13 22:28:42 +11:00
Matt Joiner 1d54b1c6d8 Massively reduce CPU when Readers are blocked on unavailable data 2017-02-01 16:28:16 +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 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 2a1cef7c9e Remove the InfoEx type, and don't generate its infohash on the fly
Fixes #106.
2016-08-26 20:29:05 +10:00
Matt Joiner b84298351a Move a few methods to Torrent, and track how many DHT announces occur
I suspect that DHT announces may occur too regularly, or without a break for torrents that aren't able to get over the lower water pending peer mark.
2016-06-15 15:29:47 +10:00
Matt Joiner 5051d1dcd0 Add Torrent.AddTrackers 2016-05-23 10:18:58 +10:00
Matt Joiner 20870ec4ff Rework torrent tracker scraping
New scrapers are added anytime trackers are added to a torrent. In the future they will also be stopped as soon as they're removed. All trackers are concurrently scraped, the old-style of sticking to one tracker that works is abandoned for now.
2016-05-22 22:45:08 +10:00
Matt Joiner b714da8184 Torrent.AddPeers can't fail, so don't return an error 2016-05-12 12:26:09 +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 c4a6f66a95 Lock now required around missinggo.Event variables 2016-05-09 16:44:06 +10:00
Matt Joiner a45a09b877 Rework setting of info bytes 2016-05-09 15:47:39 +10:00
Matt Joiner f6b83130c9 Move a bunch of Torrent methods from client.go 2016-05-03 16:47:11 +10:00