Commit Graph

13616 Commits

Author SHA1 Message Date
Dmytro Lytovchenko 312d18281d
C++ modernize: Replace MIN/MAX with type safe std::min/std::max (#1806)
* C++ modernize: Replace MIN/MAX with type safe std::min/std::max

* Template std::min/max invocations now explicitly use largest integer type

* torrent.cc did not have <algorithm> included

* MIN/MAX Changes for subprocess-win32.cc

* Using type{} style cast instead of template parameter in std::min/max

* 32-bit type cast errors with uint64_t versus size_t

* 32-bit type cast errors inout.cc and file.cc

* Missing include in windows code; Type cast error fixed

* Missing macro in win32 daemon; Replaced MIN in commented code with std::min

* Update libtransmission/tr-getopt.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update libtransmission/file-posix.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update tests/libtransmission/copy-test.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update libtransmission/peer-mgr.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Strlen returns size_t, remove cast

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-09-19 15:41:35 -05:00
dependabot[bot] 6aba12888a
chore(deps): bump browserslist from 4.14.5 to 4.16.6 in /web (#1727)
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.14.5 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.14.5...4.16.6)

---
updated-dependencies:
- dependency-name: browserslist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-09-17 09:53:09 -05:00
Charles Kerr 7e06c6401f
fix: clang warnings (#1814)
* fix: clang nullptr dereference warning in peer-io

* fix: shared variable name clang warning in peer-io

* fix: clang nullptr dereference warning in bitfield

* fix: shadowed variable in session.cc's parse_tos()

* fix: shadowed variable warning in sessionSetImpl()

* fix: tr_stringEndsWith() shadowed variable warning

* fix: a tr_peerMgrGetNextRequests() nullptr warning
2021-09-16 23:21:50 -05:00
dependabot[bot] 4f9bb7e7f8
chore(deps): bump color-string from 1.5.4 to 1.6.0 in /web (#1770)
Bumps [color-string](https://github.com/Qix-/color-string) from 1.5.4 to 1.6.0.
- [Release notes](https://github.com/Qix-/color-string/releases)
- [Changelog](https://github.com/Qix-/color-string/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Qix-/color-string/compare/1.5.4...1.6.0)

---
updated-dependencies:
- dependency-name: color-string
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-09-16 21:51:10 -05:00
dependabot[bot] 2c083379e0
chore(deps): bump postcss from 7.0.35 to 7.0.36 in /web (#1771)
Bumps [postcss](https://github.com/postcss/postcss) from 7.0.35 to 7.0.36.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/7.0.35...7.0.36)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-09-16 18:51:08 -05:00
dependabot[bot] 87cefa540f
chore(deps): bump tar from 6.0.5 to 6.1.11 in /web (#1774)
Bumps [tar](https://github.com/npm/node-tar) from 6.0.5 to 6.1.11.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.0.5...v6.1.11)
2021-09-16 18:12:16 -05:00
Charles Kerr 25c4015d4a
fix: 'enumerated and non-enumerated type' warnings (#1810)
Simple change to silence warnings, changes the offending enums to be
constexprs. There is still more cleanup work to update other enums;
this just addresses the ones causing compiler warnings
2021-09-16 11:22:33 -05:00
Charles Kerr c80fb5f6e0
refactor: variant fixups (#1811)
* cleanups to the previous variant commit
2021-09-15 17:11:00 -05:00
Charles Kerr de4634f0a5
fix: clang++ nullptr dereference warning in tr_variantWalk() (#1800)
* fix: clang++ nullptr dereference warning in variant.cc
2021-09-15 13:51:19 -05:00
Charles Kerr e19353bf60
fix: dead-store asssignment warning in file-posix. (#1809)
* fix: dead-store asssignment warning in file-posix.

This also extracts the different per-platform preallocation methods into
their own standalone functions for readability and clarity.
2021-09-15 11:55:46 -05:00
Charles Kerr fc0ba38bc9
refactor: tr_quickfindFirstK --> std::partial_sort (#1794)
* refactor: tr_quickfindFirstK --> std::partial_sort

Remove `tr_quickfindFirstK()` and use `std::partial_sort()` instead.

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-15 09:32:07 -05:00
Tyler 32fab5a67b
add authentication information to rpc-spec.txt (#1808)
* document the Authentication header in rpc-spec.txt
2021-09-15 08:35:23 -05:00
Charles Kerr abdfcb9681
fix: dead store warning in peer-msgs.cc (#1804) 2021-09-14 22:49:04 -05:00
Charles Kerr 19de6035a5
fix: dead store warning in handshake.cc (#1803) 2021-09-14 21:23:53 -05:00
Dmytro Lytovchenko 43d1ece562
C++ modernization: Replace NULLs with typesafe nullptrs (#1799)
Fixing CI errors and build errors
Reverted changes: NULL in EV_SET macro; Clang-formatting
Reverted changes: MacosX *.m files reverted from master
2021-09-14 19:18:09 -05:00
Charles Kerr 098c7508e3
fix: clang nullptr dereference warning in utils.cc (#1797)
We know what strings are passed into tr_strip_positional_args(). Instead
of using dynamic allocation, use a fixed-size array that's big enough to
fit the strings that we have.
2021-09-13 08:45:01 -05:00
Charles Kerr 90605d4bd3
build: skip clang-tidy on lgtm (#1792)
* build: skip clang-tidy on lgtm

* build: skip clang-tidy on appveyor

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-09-12 14:36:51 -05:00
Charles Kerr 4c1b627647
refactor: port libtransmission to C++ (#1787)
Port libtransmission to C++. This PR doesn't refactor everything to c++.
Its code changes are only what was necessary to compile and link as c++.
See libtransmission/README.md for details on how to submit modernization 
patches!

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-12 12:41:49 -05:00
Mike Gelfand a459e5e11b
Switch to a standalone ARC4 implementation (#1788)
* Switch to a standalone ARC4 implementation

This frees us from expecting it being provided by one of the crypto
libraries we support, all of which deprecated and/or removed it at this
point.

Fixes: #1103
Fixes: #1777

* Suppress lgtm warnings about RC4 being weak (we don't care)
2021-09-12 06:47:29 +03:00
Charles Kerr 97a6f1232e
fixup! perf: prioritize announces based on scrape stats (#1782) (#1786)
* fixup! perf: prioritize announces based on scrape stats (#1782)
2021-09-11 08:11:46 -05:00
Charles Kerr 40868d1621
perf: faster tr_sessionCountQueueFreeSlots() (#1785)
The previous code had some redundant calculations, e.g. calling 
tr_torrentGetActivity() a couple of times per torrent, once in 
tr_sessionCountQueueFreeSlots() and once in tr_torrentIsStalled(). 
Only one call is necessary.

tr_sessionCountQueueFreeSlots() used to keep iterating through all 
torrents even if the number of free slots had already been decremented 
to zero, even though further iteration does not change the zero return 
value :) This PR checks the return value while looping to prevent this.
2021-09-10 15:15:35 -05:00
Charles Kerr a673c49bd6
perf: do not generate address strings as log name if logging is disabled (#1784)
* perf: if logs are disabled, don't build log names

handshake.c and peer-io.c call tr_peerIoGetAddrStr() to build a name for
passing to tr_logAddDeepNamed(). Since tr_peerIoGetAddrStr() isn't free,
make sure deep logging is enabled before building the name.
2021-09-10 12:22:46 -05:00
Charles Kerr 756bb349d6
perf: prioritize announces based on scrape stats (#1782)
* perf: prioritize announces based on scrape stats

This change is to improve responsiveness when starting a large batch of
torrents, e.g. when starting up a seedbox, but is also generally useful.

First, try to scrape as many torrents as as quickly as possible, giving
preference to that even over announces. Thanks to multiscrape we can run
through scrapes an order of magnitude faster than announces. Then scrape
responses tell us which swarms have leechers and we can prioritize those
torrents' announces.

Second, increase how many scrapes and announces we start at a time. This
limit probably hasn't been needed since 2da97b25 and by scraping faster,
the sooner we'll know which torrents to announce first.

* chore: remove printf() tracer
2021-09-09 19:28:22 -05:00
Charles Kerr d6cb99e57c
perf: use scrape to know when a private swarm is all-seeds (#1780)
* perf: use scrape to know when a swarm is all-seeds

For private torrents, the tracker is the sole source of peers. So when a
private torrent's tracker responds that there are 0 leechers, we can use
that information to mark the entire swarm as seeders and to not initiate
connections to those peers if we are seeding. This can help seedboxes to
more efficiently pick which swarms to prioritize.

This strategy is not used on public torrents, since new seeder-to-seeder
connections can be useful there for pex.

This PR changes tr_peerMgrAddPex() to (1) remove tr_atom.seedProbability
field (which was not as robust as intended) and (2) add batches of peers
instead of a single peer.

* fix: only use all-seeds check for private torrents
2021-09-09 15:25:30 -05:00
Charles Kerr f83e07e2a0
perf: do not rechoke in tr_peerMgrStartTorrent() (#1779)
tr_peerMgrStartTorrent() is called once per torrent on startup, so this
can be expensive if the user has a lot of torrents.

Instead, enqueue a pending rechoke that will happen on idle. This way,
all the added torrents can be handled by a single rechoke call.
2021-09-09 07:36:10 -05:00
Charles Kerr c0ed82533c
perf: lookup tables for faster torrent searching. (#1778)
* perf: lookup tables for faster torrent searching.

tr_torrentFindFromId(), tr_torrentFindFromHashString(), and
tr_torrentFindFromHash() are now O(log N) instead of O(N) where
N is the number of torrents.

* build: fix clang-tidy warning

error: integer to pointer cast pessimizes optimization opportunities
[performance-no-int-to-ptr,-warnings-as-errors] from TR_BAD_SYS_FILE
which expands to INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
2021-09-09 00:22:29 -05:00
dependabot[bot] 696b0bcab9
chore(deps): bump path-parse from 1.0.6 to 1.0.7 in /web (#1755)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-08-28 18:40:39 -05:00
Charles Kerr 3f89260bc4
chore: add build/ to clang-tidy exclude list (#1769) 2021-08-28 07:46:25 -05:00
Charles Kerr 59efe4642d
feat: allow filtering torrents by info hash in qt client (#1763)
* feat: allow filtering torrents by info hash
2021-08-27 12:58:47 -05:00
Nathan Benichou 1077f639b4
add status description to rpc-spec.txt (#1760)
I couldn't find infos about the "status" field of "torrent-get" in this file or on the web, so I had to look in the source code to find it, and I don't think everyone will do that. So it would be nice for this file to contain details about status

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-08-27 11:24:57 -05:00
Mike Gelfand 841f56dc3a Use PowerShell instead of ImageMagick for AppVeyor build 2021-08-24 08:55:53 +03:00
Mitch Livingston 0e2ecd8f63
Merge pull request #1765 from transmission/news-metadata
Update NEWS
2021-08-22 19:32:42 -04:00
Mitch Livingston 17914bed2c
Merge pull request #1080 from guidocella/prefetch-magnet
Fetch metadata of stopped magnets
2021-08-22 19:30:30 -04:00
Mitchell Livingston f43eb91882 Update NEWS 2021-08-22 19:03:24 -04:00
Mitch Livingston e9a39fb608
Merge branch 'master' into prefetch-magnet 2021-08-22 18:56:58 -04:00
Han Shen a44b0f8009
Add instruction in README.md to config a release build. (#1282)
* Add instruction in README.md to config a release build.

* Use RelWithDebInfo instead of Release in README.md

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-19 00:18:22 +03:00
Sergey Fedoseev 846dafb07e
Add Sort by Queue menu item to popup menu (#1040)
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-18 23:15:40 +03:00
Mike Gelfand 8c9faf1f71 Set default Mac target version in CMake to avoid extra warnings 2021-08-17 00:32:32 +03:00
Mike Gelfand 407201c207 Combine all tests in a single executable to speed up the build 2021-08-16 23:16:36 +03:00
Mike Gelfand 647c171636 Clean-up leftover mentions of uncrustify, fix custom format targets 2021-08-16 01:08:56 +03:00
Mike Gelfand db3d40d0ed Switch to clang-format for code formatting, include Mac client 2021-08-16 00:38:29 +03:00
Mike Gilbert 409f59889b
Restore support for the INSTALL_LIB option (#1756)
It appears this was removed by accident.

Fixes: 677dc73eac
2021-08-13 21:26:38 +03:00
Daniel Kamil Kozar 79e8bc5c46
Remove unnecessary "id" member of TrNotification in gtk/notify.c (#851)
The "id" member's only purpose is to serve as the key for the
active_notifications hash table. However, the same thing can be very easily
achieved by switching the GHashTable's hash/equal functions to "direct", which
just use the void pointers (which all keys are in a GHashTable) directly as if
they were values, and use GUINT_TO_POINTER() when referring to this hash table's
key.

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-08 00:24:11 +03:00
dubhater a7370fe8fb
Qt: Move icon after "Alternative Speed Limits" label (#503)
Looks better and matches the Gtk client.

Co-authored-by: dubhater <cantabile.desu@gmail.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 17:57:59 +03:00
dubhater f804043b85
Qt: Use file selector in Set Location if session is local (#502)
It's the only place where Session::isServer() is used to decide if
a file selector should be used, or a text box. Session::isLocal()
is used everywhere else.

Co-authored-by: dubhater <cantabile.desu@gmail.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 17:08:37 +03:00
dubhater 6f76d8fae7
Qt: Add tooltips for Options, Statistics buttons (#501)
Same as in the Gtk client.

Co-authored-by: dubhater <cantabile.desu@gmail.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 14:21:06 +03:00
Sam Marcus 55060fcaa9
Update README.md (#459) 2021-08-07 13:31:28 +03:00
Koro ab1c452dd7
Display more progress information during torrent creation. (#1405)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-08-07 13:15:06 +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
Dmitry Serov af3a4d4557
Modern Objective-C syntax (#509)
* Update enabled complier warnings

* Convert to Modern Objective-C syntax using Xcode's tool

* Convert to modern objc syntax manually, fix some PR issues

* Remove unnecessary parentheses

* Use property syntax for all custom properties

* Use property syntax for all system properties

* Fix erroneously autoreleased values

* Revert VDKQueue to old objc syntax

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
Co-authored-by: Mitch Livingston <livings124@mac.com>
2021-08-07 10:27:56 +03:00