mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 05:38:06 -06:00
Allow to fetch data asynchronously
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2015-2022 Vladimir Golovnev <glassez@yandex.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -31,16 +31,15 @@
|
||||
#include <QBitArray>
|
||||
|
||||
#include "base/bittorrent/ltqbitarray.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "peeraddress.h"
|
||||
|
||||
using namespace BitTorrent;
|
||||
|
||||
PeerInfo::PeerInfo(const Torrent *torrent, const lt::peer_info &nativeInfo)
|
||||
PeerInfo::PeerInfo(const lt::peer_info &nativeInfo, const QBitArray &allPieces)
|
||||
: m_nativeInfo(nativeInfo)
|
||||
, m_relevance(calcRelevance(torrent))
|
||||
, m_relevance(calcRelevance(allPieces))
|
||||
{
|
||||
determineFlags();
|
||||
}
|
||||
@@ -246,9 +245,8 @@ QString PeerInfo::connectionType() const
|
||||
: u"Web"_qs;
|
||||
}
|
||||
|
||||
qreal PeerInfo::calcRelevance(const Torrent *torrent) const
|
||||
qreal PeerInfo::calcRelevance(const QBitArray &allPieces) const
|
||||
{
|
||||
const QBitArray allPieces = torrent->pieces();
|
||||
const int localMissing = allPieces.count(false);
|
||||
if (localMissing <= 0)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user