Commit Graph

12 Commits

Author SHA1 Message Date
Charles Kerr 7c87cb36eb
refactor: tr_torrent_metainfo (#2340)
* refactor: add tr_torrent_metainfo class

Can be used for parsing bencoded .torrent data without instantiating
a tr_torrent. This will be used in all the places where client code
needs to test a .torrent file for validity / to add a preview window
before adding the torrent.
2021-12-25 15:21:13 -06:00
Charles Kerr 656df477f2
refactor: add tr_announce_list (#2308)
* refactor: add tr_announce_list (#2308)
2021-12-14 14:59:40 -06:00
Charles Kerr 35fe175f2a
refactor: add file-piece-map (#2246)
* refactor: add file-piece-map

* refactor: use tr_file_priorities

* refactor: use tr_files_wanted
2021-11-28 19:12:54 -06:00
Charles Kerr de169c7ec3
refactor: tr_completion (#2220)
* refactor: refactor tr_completion + add test coverage for it
2021-11-25 12:26:51 -06:00
Charles Kerr 843e486d2a
refactor: tr_block_info class (#2210)
* refactor: add tr_block_info with tests
2021-11-24 08:48:52 -06:00
Charles Kerr 073c6af1d6
refactor: swarm (#2103)
* refactor: encapsulate request tracking in a class

Introduces a new class to peer-mgr, `ClientRequests`, which tracks what
active requests we've got pending: which blocks, when the requests were
sent, and who they were sent to.

This shouldn't change peer-mgr behavior. Its goal is to carve out some
of peer-mgr's data structures and encapsulte them behind an API that's
simpler to understand.

* refactor: move ActiveRequests to its own file

* perf: avoid duplicate call to tr_cpMissingBlocksInPiece
2021-11-19 12:37:38 -06:00
Charles Kerr 7693ef69bf
refactor: magnet metainfo (#2124)
* refactor: magnet-metainfo
2021-11-09 20:42:18 -06:00
Charles Kerr d8b57fe4dc
refactor: web_utils (#2121)
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00
Charles Kerr fb39c4663c
Fix/benc zero length dict key (#1964)
* fix: benc decoding bug that failed to parse hybrid torrents
2021-10-15 13:13:33 -05:00
Mike Gelfand 407201c207 Combine all tests in a single executable to speed up the build 2021-08-16 23:16:36 +03:00
RobCrowston 0155252823
Add in-kernel file copying for several platforms. (#1092)
* Add in-kernel copying support for Linux (sendfile64(2), copy_file_range(2)), FreeBSD 13 (copy_file_range(2)), MacOS (copyfile(2)), and Windows (CopyFileExA).

* Fix macro name USE_COPY_FILE_RANGE.

* Minor bugfixes for userspace fallback.

* Fix linux sendfile64 bugs.

* Remove some overzealous asserts.

* Allow transmission-test-copy to take an optional argument for an external reference file.

* Fix return value error of tr_sys_path_copy.

* Use COPYFILE_ALL for Macs without COPYFILE_CLONE.

* Add in-kernel file copying for several platforms.

Numerous operating systems now have support for copying files directly in the
kernel, which is generally more efficient than copying in a userspace read(2)/
write(2) loop. (This becomes particularly relevant for 4th gen PCI-E storage,
which approaches the latency of DRAM.) For Linux I use sendfile64(2), and, for
later kernels, copy_file_range(2). FreeBSD 13 will also support
copy_file_range(2). MacOS has copyfile(2), and Windows has CopyFileExA.
Operating systems lacking such a syscall continue to use the existing
read(2)/write(2) loop.

* Appease uncrustify.

* Appease uncrustify.

* copy-test: generate random content at run time.

* copy-test: Stylistic changes and more check()s.

* copy-test: files_are_identical should follow test idioms

* tr_sys_path_copy: numerous tweaks as requested by review.

* s/old file/source file; s/new file/destination file.

* tr_sys_path_copy: handle win32 wide characters in paths.

* Uncrustify.

* test-copy: Use non-string create_file_with_contents.

* tr_sys_path_copy: numerous fixes.

Per review: generate test file content at runtime; tidy use of check();
fix style; re-measure file sizes in the copy; define a macro when the
system does not provide it; use Unicode APIs on Windows; and fix
documentation.

* Updated as per comments.

* Rebase kernel-copy changes onto 3.0 with gtest.

* Undo irrelevant comment change.

* Fix syntax error.

* Use tr_malloc() instead of tr_valloc().

* Use EXPECT instead of TR_ASSERT in gtest.

* Add error handling.

* Acceptable coding style has changed again.

Now it's camelCase. Also use nullptr instead of NULL, etc.

* Fix east/west const.

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 12:04:03 +03:00
Charles Kerr 677dc73eac
refactor: use GTest for running tests (#1383)
* refactor: use google-test on libtransmission tests
2020-08-11 13:11:55 -05:00