mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
committed by
GitHub
parent
e7dee969e1
commit
6cd6267c26
@@ -1242,7 +1242,7 @@ qreal SessionImpl::globalMaxRatio() const
|
||||
void SessionImpl::setGlobalMaxRatio(qreal ratio)
|
||||
{
|
||||
if (ratio < 0)
|
||||
ratio = -1.;
|
||||
ratio = Torrent::NO_RATIO_LIMIT;
|
||||
|
||||
if (ratio != globalMaxRatio())
|
||||
{
|
||||
@@ -2331,7 +2331,7 @@ void SessionImpl::processTorrentShareLimits(TorrentImpl *torrent)
|
||||
QString description;
|
||||
|
||||
if (const qreal ratio = torrent->realRatio();
|
||||
(ratioLimit >= 0) && (ratio <= Torrent::MAX_RATIO) && (ratio >= ratioLimit))
|
||||
(ratioLimit >= 0) && (ratio >= ratioLimit))
|
||||
{
|
||||
reached = true;
|
||||
description = tr("Torrent reached the share ratio limit.");
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "torrent.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <QHash>
|
||||
|
||||
#include "infohash.h"
|
||||
@@ -51,7 +53,7 @@ namespace BitTorrent
|
||||
const int Torrent::USE_GLOBAL_INACTIVE_SEEDING_TIME = -2;
|
||||
const int Torrent::NO_INACTIVE_SEEDING_TIME_LIMIT = -1;
|
||||
|
||||
const qreal Torrent::MAX_RATIO = 9999;
|
||||
const qreal Torrent::MAX_RATIO = std::numeric_limits<qreal>::infinity();
|
||||
|
||||
TorrentID Torrent::id() const
|
||||
{
|
||||
|
||||
@@ -1515,7 +1515,8 @@ qreal TorrentImpl::realRatio() const
|
||||
|
||||
const qreal ratio = upload / static_cast<qreal>(download);
|
||||
Q_ASSERT(ratio >= 0);
|
||||
return (ratio > MAX_RATIO) ? MAX_RATIO : ratio;
|
||||
|
||||
return ratio;
|
||||
}
|
||||
|
||||
int TorrentImpl::uploadPayloadRate() const
|
||||
@@ -2677,8 +2678,6 @@ void TorrentImpl::setRatioLimit(qreal limit)
|
||||
{
|
||||
if (limit < USE_GLOBAL_RATIO)
|
||||
limit = NO_RATIO_LIMIT;
|
||||
else if (limit > MAX_RATIO)
|
||||
limit = MAX_RATIO;
|
||||
|
||||
if (m_ratioLimit != limit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user