Commit Graph

58 Commits

Author SHA1 Message Date
Matt Joiner 2be5a95b06 Add reasons for updateRequests to be triggered 2021-10-19 14:08:56 +11:00
Matt Joiner 62c83a5b9c Add to tests for Torrent.Complete 2021-10-07 13:38:29 +11:00
Matt Joiner 63b3d2d211 Track dirty chunks in a single bitmap on Torrent 2021-09-20 18:52:54 +10:00
YenForYang a8db640c62
Drop bradfitz/iter dependency (#605)
* Drop bradfitz/iter dependency

`range iter.N` looks nice and doesn't allocate, but unfortunately using a `range` expression blocks a function from being inlined wherever it's used (for now). It's not that we need inlining in all cases, but I do think a C-style for loop looks just as nice and is probably clearer to the majority. There also aren't any clear disadvantages to changing (unless you just happen to dislike the look of C)

* Update misc_test.go

* Update rlreader_test.go

* Update torrent_test.go

* Update bench_test.go

* Update client_test.go

* Update iplist_test.go

* Update mse_test.go

* Update peerconn_test.go

* Update peerconn.go

* Update order_test.go

* Update decoder_test.go

* Update main.go

* Update bench-piece-mark-complete.go

* Update main.go

* Update torrent.go

* Update iplist_test.go

* Update main.go
2021-09-14 13:46:50 +10:00
Matt Joiner bf6e64a652 Fix some DeepSource lints 2021-08-30 11:48:34 +10:00
Matt Joiner 22c5a94a6a Use roaring.Bitmap directly for completed pieces
Looking at improving the performance around this per https://github.com/anacrolix/torrent/discussions/547#discussion-3522317.
2021-08-16 11:07:10 +10:00
Matt Joiner c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner 95d808d3c5 Use rejiggered missinggo bitmap 2021-06-07 13:01:39 +10:00
Matt Joiner 7f7c59d52e Replace internal/tmproot with Testing.TB.TempDir 2021-02-22 14:30:09 +11:00
Matt Joiner f5915ad12c Use iotest.TestReader 2021-01-29 23:32:01 +11:00
Matt Joiner 456a2f7c5d Expose more callbacks and Request and ChunkSpec 2021-01-28 14:23:22 +11:00
Matt Joiner 8a2ff43246 Tidy up the interface changes 2020-06-02 17:41:59 +10:00
Matt Joiner 3e9a5a4aec Expose ClientConfig.Extensions
Also run the storage failure test with fast disabled for the seeder. This probably would have tickled some issues in the past, so it seems like a good place to try it out.
2020-04-23 13:03:40 +10:00
Yaroslav Kolomiiets 93430aa01a PEX: add connection tracking 2020-04-15 17:24:44 +10:00
Yaroslav Kolomiiets 634edd2875 Share current connections with peers over PEX (anacrolix#341) 2020-04-15 17:24:44 +10:00
Matt Joiner cf0d0118ea Finish fixing IP banning on storage errors 2020-01-23 13:54:37 +11:00
Matt Joiner 35cdebdc3b Fix panic in benchmark due to requestStrategy changes 2020-01-14 10:51:09 +11:00
Matt Joiner 4c989da21e Extract the request strategy logic
Bit messy. Now it'll be easier to clean-up what it depends on, and test.
2020-01-14 10:51:09 +11:00
Matt Joiner cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner 5a2c1c9b76 Upgrade to simplified logger 2019-08-21 20:44:12 +10:00
Matt Joiner 338287486f Always return errors when handshakes or dialing fails
I intend to use xerrors-style error handling for special cases.
2019-07-19 16:15:46 +10: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 324cc7a281 Comments and trivial tweaks 2018-07-12 09:42:00 +10:00
Matt Joiner f5bd377941 Change pieceIndex to peer_protocol.Integer 2018-07-12 09:15:15 +10:00
Matt Joiner 76a3c0891a Expose handshake stuff in peer_protocol 2018-07-07 11:31:29 +10:00
Matt Joiner 2852fee357 Fix some testing code for Config->ClientConfig 2018-06-16 17:01:21 +10:00
Matt Joiner 319e57d1c6 Rework conns to/and allow multiple DHT servers
This will help with #229, and IPv6 support.
2018-04-12 11:41:07 +10:00
Matt Joiner 64c40a45b4 Fix panic in benchmark caused by new logging 2018-01-29 19:16:55 +11:00
Matt Joiner 77806c1f49 More development of the new logging interface 2018-01-29 18:22:21 +11:00
Matt Joiner 53e32ca9dd Start using new log package 2018-01-28 16:07:11 +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 e3c098441a Add Torrent.setInfo 2018-01-25 17:10:37 +11:00
Matt Joiner e13b0eccbf Make peerID a public type
Wanted it applied to Client Status output
2018-01-06 15:50:45 +11:00
Matt Joiner 3aa1e8f3ef Add a test for behaviour after getting metadata_size and before GotInfo
#208
2017-11-08 19:31:10 +11:00
Matt Joiner b3137b1ede Make type piece public 2017-09-15 19:35:16 +10:00
Matt Joiner 49648b9ae1 Close implicit Client default storage on Client.Close
Fixes #158
2017-06-01 22:57:08 +10:00
Chris Walker 9d96cd659f fix `Spec.Storage` and allow per-torrent dir
`TorrentSpec.Storage` was not honored when calling `Client.AddTorrentSpec`
and the configured `cfg.DefaultStorage` was always used. Now if you construct
your `TorrentSpec` you can specify any `StorageImpl`

Also, the most common use case for custom storage being per-torrent paths for
FileStorage, this adds a `pathMaker` function to the File implementation that
allows customization, along with the default (always use base path) and my use
case (which seemed common enough from the Gitter chat) which is infohash based
subdirectories.

All Public methods have not changed signature, but 1 private method did, hence
the test update.
2017-03-16 14:40:21 +00:00
Matt Joiner bb4d344235 Fix race condition in TestPieceHashFailed 2016-12-13 14:44:00 +11:00
Matt Joiner c8dffdbb11 Add test that dirty chunks are cleared on piece hash failure 2016-12-06 15:41: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 e1c6892eca Test empty files and zero piece length for both file and mmap storage backends 2016-09-12 17:11:32 +10:00
Matt Joiner 011838998e Add test for issue #111 and #112 2016-09-12 16:53:20 +10:00
Matt Joiner 792ab183e4 Add a benchmark for an observed slow case with Torrent.updatePiecePriorities 2016-08-30 14:21:50 +10:00
Matt Joiner d3a1c79c79 Merge Torrent and torrent types 2016-04-03 18:40:43 +10:00
Matt Joiner 19021f1360 Invalid test
The function is never exposed publicly or called without holding the client lock.
2015-08-05 02:38:36 +10:00
Matt Joiner bb28ff7492 Replace pruning timer with as-required connection dropping 2015-06-30 00:45:26 +10:00
Matt Joiner 842a32ae0c Rewrite import paths for migration from Bitbucket 2015-03-20 16:37:44 +11:00
Matt Joiner a7dddd9be6 Rewrite handshaking and connection management 2015-03-18 18:28:13 +11:00
Matt Joiner 0eb418360b Allow configuring Client torrent data opener, config dir, disabling metainfo cache, and prune with a timer instead of goroutine 2015-02-25 14:48:39 +11:00