Commit Graph

214 Commits

Author SHA1 Message Date
Matt Joiner cfa54ead7c Use badStorage for TestPeerInvalidHave 2017-09-18 12:15:14 +10:00
Matt Joiner 07679c3895 Remove test temporary directories when finished
They're all grouped together in a parent directory that gets removed. Testing with mmap storage can generate very large files on bad filesystems.
2017-09-18 12:14: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 5d3ee0a531 Fix panic when error occurs binding uTP socket
Fixes #187.
2017-09-14 00:25:29 +10:00
Matt Joiner 705de83a5a TestUTPRawConn: More tidying, and slow down the rate 2017-09-01 15:22:08 +10:00
Matt Joiner 158dab71c9 Use require in some places in TestUTPRawConn 2017-09-01 15:09:10 +10:00
Matt Joiner a8a1ea755d Remove unused functions 2017-08-26 13:23:04 +10:00
Matt Joiner c0dd0f63a1 Fix test 2017-08-07 22:11:25 +10:00
Matt Joiner 2624281842 Changes for dht-cleanup 2017-07-21 00:40:49 +10:00
Matt Joiner ae8b03d586 Use go-libutp if cgo is enabled 2017-06-16 18:08:24 +10:00
Matt Joiner 49648b9ae1 Close implicit Client default storage on Client.Close
Fixes #158
2017-06-01 22:57:08 +10:00
Matt Joiner 1c37903a74 Remove FileStorePieces storage backend
ResourcePIeces is now preferred.
2017-01-05 17:00:59 +11:00
Matt Joiner 1e033d5f91 sortimports 2017-01-05 17:00:16 +11:00
Matt Joiner b68d7cd08e dht/… moved to github.com/anacrolix/dht 2016-12-14 11:43:37 +11:00
Matt Joiner 3602d90b65 gofmt simplify 2016-11-22 14:01:09 +11:00
Matt Joiner d4cbdc5c38 Add download rate limiting
Fixes #121.
2016-10-10 17:29:39 +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 aefc63b9d3 Default to debug mode in client testing config 2016-10-05 15:57:38 +11:00
Matt Joiner c593366aab Create missing intermediate directories in test 2016-09-21 21:17:22 +10:00
Matt Joiner 0c9c3d35cf Tidy up TestMultipleTorrentsWithEncryption test 2016-09-21 21:02: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
Michael Howell 9a4fbb01f0 Add a test case for #114 (#117) 2016-09-17 00:01:15 +10:00
Matt Joiner 1100aaa553 Relax the seeder torrent connection stats test
The values have changed due to the recent storage change, I'm not sure why, and I don't know if it's important.
2016-09-02 15:26:21 +10:00
Matt Joiner 1e919dd6b1 Rework storage interfaces to make them simpler to implement
This allows lots of behaviour to be baked into the new Client, Torrent and Piece wrappers, rather than duplicating (badly) them in all the backend implementations.
2016-09-02 15:10:57 +10:00
Matt Joiner ab8349eee1 Improve test reliability on Linux and reduce log noise in tests 2016-08-31 20:14:57 +10:00
Matt Joiner 3c2db92a83 Add boltdb storage backend 2016-08-31 17:48:50 +10:00
Matt Joiner 6f7623ff3c Add missing error return check in benchmark 2016-08-30 14:09:01 +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 534275b625 Always run seeder and leecher on the same ports, to flex dht.Socket.CloseNow 2016-07-30 00:42:22 +10:00
Matt Joiner debcb10b08 Some comments helping to break up the blocks in testClientTransfer 2016-07-24 00:35:34 +10:00
Matt Joiner 192bb829fb Remove duplicate seeder stat test assertions 2016-07-12 18:09:24 +10:00
Matt Joiner fbe0ded844 Add connection read stats 2016-07-12 16:42:04 +10:00
Matt Joiner 7f6b9dbf7a Remove unnecessary log in test 2016-07-11 15:03:29 +10:00
Matt Joiner 40aa30d984 Rework the client transfer test to allow non-piece-based leecher storage
In preparation for tests for data going missing for the file-based storages. Issue #96
2016-07-10 15:01:08 +10:00
Matt Joiner f39ab0cb8f Revert "Revert "TestSetMaxEstablishedConn does now work with utp""
This reverts commit 9b3869f3c5.
2016-07-07 14:16:06 +10:00
Matt Joiner 9b3869f3c5 Revert "TestSetMaxEstablishedConn does now work with utp"
This reverts commit eb1be48cc6.
2016-07-06 14:05:03 +10:00
Matt Joiner eb1be48cc6 TestSetMaxEstablishedConn does now work with utp
I think dialing out from a utp.Socket before its reader has initialized may be the cause. Either way moving the addPeers to after all the Clients are initialized has worked around it as a side effect.
2016-07-06 11:05:04 +10:00
Matt Joiner b7cd79ef62 Use addClientPeer helper in tests 2016-07-06 08:31:30 +10:00
Matt Joiner 0661689228 Add more thorough tests for Torrent.SetMaxEstablishedConns 2016-07-06 08:30:34 +10:00
Matt Joiner 240abaf512 Add Torrent.SetMaxEstablishedConns 2016-07-06 00:42:16 +10:00
Matt Joiner 12191dbfa3 Add counters for uploads
Fixes #71.
2016-07-05 15:52:33 +10:00
Matt Joiner 000f430105 Add tests for #81 2016-05-24 19:35:23 +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 c1e0d37266 Rename some storage funcs 2016-05-16 22:02:03 +10:00
Matt Joiner 02ea8b1081 Rename storage.I->Client 2016-05-16 21:50:43 +10:00
Matt Joiner 9b5d3cac03 Test both resource and file backends to piece storage 2016-05-16 20:11:00 +10:00
Matt Joiner 52e285ea86 Remove unused fields in testDownloadCancelParams 2016-05-16 20:10:33 +10:00
Matt Joiner 506ad00fd5 Probably fix test failure
Due to some changes in the Torrent instantiation code, I think there's a race in this test to verify the piece before counting the pending chunks. The torrent isn't supposed to be complete to begin with, so give it a bogus data directory to ensure it.
2016-05-12 12:44:51 +10:00
Matt Joiner dce3a7f675 Rework Client listeners
In particular, if the ListenAddr used a dynamic port ":0", and both TCP and uTP were enabled. If the TCP listen succeeded, and the uTP did not, the TCP listener was leaked, and another port number was not tried.
2016-05-11 21:11:52 +10:00
Matt Joiner a45a09b877 Rework setting of info bytes 2016-05-09 15:47:39 +10:00
Matt Joiner cee49435e0 Add Client.AddTorrentInfoHash, and some other tidying
Remove Client.bannedTorrents, which shouldn't have been in use anymore. Also fix Client.newTorrent.
2016-05-09 14:37:29 +10:00
Matt Joiner 0fd73396fd missinggo.Event changed, connection.writeOptimizer changes 2016-05-07 18:56:44 +10:00
Matt Joiner b5812bb0b7 Remove the last of the "config dir" stuff
This just conflates the Client. It should be done orthogonally.
2016-05-05 23:05:28 +10:00
Matt Joiner 2d160b0419 metainfo.InfoEx.Hash becomes a function, UpdateBytes is added, and Bytes used in marshalling
Fixes #80.
2016-05-05 22:40:38 +10:00
Seth Hoenig 9f4bf70e17 refactor struct identifiers to follow conventional go names 2016-04-18 23:11:11 -05:00
Matt Joiner 1566e2afdc Remove deadcode 2016-04-04 15:18:51 +10:00
Matt Joiner 8f164ae956 Remove some of the magic ConfigDir stuff
This might become a helper. Torrent file cache still remains.
2016-04-04 14:04:48 +10:00
Matt Joiner b80bb6393a Use metainfo.Hash for piece and info hashes 2016-04-04 13:01:31 +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 446e11b1fc Missing error checks in test 2016-03-30 19:16:40 +11:00
Matt Joiner c0e060de63 Suppress logging noise in tests 2016-03-30 19:12:57 +11:00
Matt Joiner 7790e72832 Move storage.FileStore interface to missinggo 2016-03-30 19:12:33 +11:00
Matt Joiner 5856b91af0 Fix missinggo import 2016-03-30 19:11:55 +11:00
Matt Joiner ee22446440 Reimplement piece storage 2016-03-29 11:14:34 +11:00
Matt Joiner a5b54f21a1 Make opening a torrent in storage an explicit method
This is storage types where opening can fail, like mmap
2016-03-28 22:40:29 +11:00
Matt Joiner 775cf53809 Get mmap storage working 2016-03-28 21:57:04 +11:00
Matt Joiner b97b50aca9 New storage interface 2016-03-28 20:38:30 +11:00
Matt Joiner ac184c8f52 Tidy up a test that fails with the wrong reasons 2016-03-24 23:52:38 +11:00
Matt Joiner 0c877a9d94 Add a test for bad have messages
The reason for the cleanup to peer have-related messages in the first place.
2016-03-22 13:09:02 +11:00
Matt Joiner 67aea29ba9 Extend the timeout, drone.io is slow? 2016-02-26 22:18:08 +11:00
Matt Joiner a8ad7dfd0e Add test checking that cancel works 2016-02-26 22:10:29 +11:00
Matt Joiner 5cc8d8a652 Catch error creating client in tests 2016-02-26 22:10:09 +11:00
Matt Joiner 976510db60 Add DHT nodes from metainfo when added to Client 2016-02-24 21:56:50 +11:00
Matt Joiner 5665505dc7 Test that metainfo nodes are added to the DHT 2016-02-24 01:48:44 +11:00
Matt Joiner c03593bc01 Catch error creating new client in test 2016-02-22 14:30:02 +11:00
Matt Joiner 033c95d73b Add a client transfer test with limited file cache, and a second pass read 2016-02-22 02:41:07 +11:00
Matt Joiner c50742fdac Move exportClientStatus to testutil.ExportStatusWriter 2016-02-22 02:36:41 +11:00
Matt Joiner fd42ed877f Don't run TestCompletedPieceWrongSize in parallel because it messes up logs 2016-02-22 00:31:06 +11:00
Matt Joiner c64ad19dbb Test a ton of permutations for readahead and responsive 2016-02-22 00:30:42 +11:00
Matt Joiner 4846021c0c Tidy up TestClientTransfer 2016-02-21 22:08:01 +11:00
Matt Joiner d5f888069f Ditch Data.WriteSectionTo, and fix cmd/torrent-verify 2016-02-18 11:45:31 +11:00
Matt Joiner dcce061152 Rework Reader reading, and TestCompletedPieceWrongSize 2016-02-17 18:26:10 +11:00
Matt Joiner 7ab984ab52 Add a test for starting a torrent where pieces are already complete 2016-02-17 17:09:05 +11:00
Matt Joiner 0f9f7ba01b Add torrent.completedPieces bitmap
Reduce load on data.PieceComplete for torrents with lots of pieces, when reader position changes. Not sure of the improvement yet.
2016-02-17 00:00:55 +11:00
Matt Joiner dc215d083e Export PieceStateChange through piece state change pubsub 2016-02-07 21:55:47 +11:00
Matt Joiner 0c28a0f1b1 Use new tracker package interface 2016-02-07 18:49:35 +11:00
Matt Joiner b4f04ddc61 Missing Reader.Close in some tests 2016-02-05 01:17:26 +11:00
Matt Joiner b8e9ef4be2 Export leecher and seeder in TestClientTransfer 2016-02-01 21:09:25 +11:00
Matt Joiner eb838a894c newTorrent doesn't need to return error 2016-02-01 07:05:43 +11:00
Matt Joiner 94d764e6be Readers changing wasn't triggering waitAccept
Caused occasional stall in TestSeedAfterDownloading.
2016-01-25 04:14:19 +11:00
Matt Joiner 9f79838033 require->assert in test 2016-01-19 01:41: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 8696f32e58 Make Config.DHTConfig not a pointer 2016-01-17 00:12:53 +11:00
Matt Joiner 2beb5f8bd4 Track dirty chunks, instead of pending chunk specs
This is the first step toward having purely Reader-based priorities. If a chunk is pending, that currently implies that we want to download it. I want to move that kind of state out to the readers.
2016-01-13 17:11:59 +11:00
Matt Joiner 153c13db43 Revert "Merge pull request #54 from zhulik/master"
This reverts commit 5cf75b869c, reversing
changes made to 09050ff2c5.
2016-01-06 12:19:49 +11:00
Gleb Sinyavsky 5b790bf874 Torrent structs replaced with Download interface in exported Client methods 2015-12-27 14:49:15 +03:00