mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06:00
Prepare for libtorrent v1.1 support
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <libtorrent/alert_types.hpp>
|
||||
#include <libtorrent/create_torrent.hpp>
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -433,7 +434,7 @@ bool TorrentHandle::connectPeer(const PeerAddress &peerAddress)
|
||||
libt::address addr = libt::address::from_string(Utils::String::toStdString(peerAddress.ip.toString()), ec);
|
||||
if (ec) return false;
|
||||
|
||||
libt::asio::ip::tcp::endpoint ep(addr, peerAddress.port);
|
||||
boost::asio::ip::tcp::endpoint ep(addr, peerAddress.port);
|
||||
SAFE_CALL_BOOL(connect_peer, ep);
|
||||
}
|
||||
|
||||
@@ -847,7 +848,7 @@ qulonglong TorrentHandle::eta() const
|
||||
|
||||
QVector<qreal> TorrentHandle::filesProgress() const
|
||||
{
|
||||
std::vector<libt::size_type> fp;
|
||||
std::vector<boost::int64_t> fp;
|
||||
QVector<qreal> result;
|
||||
SAFE_CALL(file_progress, fp, libt::torrent_handle::piece_granularity);
|
||||
|
||||
@@ -1022,9 +1023,9 @@ qreal TorrentHandle::maxRatio(bool *usesGlobalRatio) const
|
||||
|
||||
qreal TorrentHandle::realRatio() const
|
||||
{
|
||||
libt::size_type upload = m_nativeStatus.all_time_upload;
|
||||
boost::int64_t upload = m_nativeStatus.all_time_upload;
|
||||
// special case for a seeder who lost its stats, also assume nobody will import a 99% done torrent
|
||||
libt::size_type download = (m_nativeStatus.all_time_download < m_nativeStatus.total_done * 0.01) ? m_nativeStatus.total_done : m_nativeStatus.all_time_download;
|
||||
boost::int64_t download = (m_nativeStatus.all_time_download < m_nativeStatus.total_done * 0.01) ? m_nativeStatus.total_done : m_nativeStatus.all_time_download;
|
||||
|
||||
if (download == 0)
|
||||
return (upload == 0) ? 0.0 : MAX_RATIO;
|
||||
@@ -1689,7 +1690,6 @@ libtorrent::torrent_handle TorrentHandle::nativeHandle() const
|
||||
void TorrentHandle::updateTorrentInfo()
|
||||
{
|
||||
if (!hasMetadata()) return;
|
||||
|
||||
m_torrentInfo = TorrentInfo(m_nativeStatus.torrent_file);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user