arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.09k stars 983 forks source link

32-bit signed int is not enough for transfer rates #7693

Open HanabishiRecca opened 3 days ago

HanabishiRecca commented 3 days ago

libtorrent version (or branch): 2.0.10

platform/architecture: Linux x86-64

compiler and compiler version: gcc 14.1.1

As the title says, I'm actually able to acheive transfers rates more than 2 GiB/s in qBittorrent and exceed the max int32 value. This leads to weird results. See https://github.com/qbittorrent/qBittorrent/issues/21003 for details.

The root of the problem is fairly straghtforward:

https://github.com/arvidn/libtorrent/blob/ba3a13c3413b52b78e0f23edc642690db1dfd848/include/libtorrent/torrent_status.hpp#L316-L317

https://github.com/arvidn/libtorrent/blob/ba3a13c3413b52b78e0f23edc642690db1dfd848/include/libtorrent/torrent_status.hpp#L323-L324

Maybe it's time to promote the values to int64_t.