2015-04-19 18:17:47 +03:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt and libtorrent.
|
|
|
|
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
|
|
|
|
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
|
|
|
*/
|
|
|
|
|
2020-12-10 20:56:37 +03:00
|
|
|
#pragma once
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2020-04-04 07:50:11 +03:00
|
|
|
#include <memory>
|
2018-05-08 07:11:00 +03:00
|
|
|
#include <vector>
|
|
|
|
|
2020-08-05 08:31:41 +03:00
|
|
|
#include <libtorrent/add_torrent_params.hpp>
|
2019-05-09 07:58:04 +03:00
|
|
|
#include <libtorrent/fwd.hpp>
|
2020-05-08 14:42:02 +03:00
|
|
|
#include <libtorrent/torrent_handle.hpp>
|
2020-06-26 03:05:09 +03:00
|
|
|
#include <libtorrent/version.hpp>
|
2019-05-09 07:58:04 +03:00
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
#include <QHash>
|
|
|
|
#include <QPointer>
|
2017-06-05 03:22:17 +03:00
|
|
|
#include <QSet>
|
2020-12-09 08:48:59 +03:00
|
|
|
#include <QtContainerFwd>
|
2019-08-02 07:55:06 +03:00
|
|
|
#include <QVector>
|
2016-01-20 10:15:10 +03:00
|
|
|
|
2016-05-01 11:05:52 +03:00
|
|
|
#include "base/settingvalue.h"
|
2015-09-25 11:10:05 +03:00
|
|
|
#include "base/types.h"
|
2017-04-29 11:49:40 +03:00
|
|
|
#include "addtorrentparams.h"
|
2017-04-29 14:45:30 +03:00
|
|
|
#include "cachestatus.h"
|
|
|
|
#include "sessionstatus.h"
|
2015-04-19 18:17:47 +03:00
|
|
|
#include "torrentinfo.h"
|
|
|
|
|
2020-12-01 05:37:16 +03:00
|
|
|
#if !defined(Q_OS_WIN) || (LIBTORRENT_VERSION_NUM >= 10212)
|
2020-04-22 22:50:13 +03:00
|
|
|
#define HAS_HTTPS_TRACKER_VALIDATION
|
|
|
|
#endif
|
|
|
|
|
2020-12-01 05:53:48 +03:00
|
|
|
#if ((LIBTORRENT_VERSION_NUM >= 10212) && (LIBTORRENT_VERSION_NUM < 20000)) || (LIBTORRENT_VERSION_NUM >= 20002)
|
|
|
|
#define HAS_IDN_SUPPORT
|
|
|
|
#endif
|
|
|
|
|
2019-10-01 10:33:11 +03:00
|
|
|
class QFile;
|
|
|
|
class QNetworkConfiguration;
|
|
|
|
class QNetworkConfigurationManager;
|
2015-09-25 10:52:25 +03:00
|
|
|
class QString;
|
2019-10-01 10:33:11 +03:00
|
|
|
class QThread;
|
|
|
|
class QTimer;
|
2015-09-25 10:52:25 +03:00
|
|
|
class QUrl;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
class BandwidthScheduler;
|
2020-12-02 09:16:11 +03:00
|
|
|
class FileSearcher;
|
2019-10-01 10:33:11 +03:00
|
|
|
class FilterParserThread;
|
2015-12-13 15:38:19 +03:00
|
|
|
class ResumeDataSavingManager;
|
2019-10-01 10:33:11 +03:00
|
|
|
class Statistics;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2019-09-18 19:26:01 +03:00
|
|
|
// These values should remain unchanged when adding new items
|
|
|
|
// so as not to break the existing user settings.
|
2016-02-09 11:56:48 +03:00
|
|
|
enum MaxRatioAction
|
|
|
|
{
|
2019-09-18 19:26:01 +03:00
|
|
|
Pause = 0,
|
|
|
|
Remove = 1,
|
|
|
|
DeleteFiles = 3,
|
|
|
|
EnableSuperSeeding = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum DeleteOption
|
|
|
|
{
|
|
|
|
Torrent,
|
|
|
|
TorrentAndFiles
|
2016-02-09 11:56:48 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum TorrentExportFolder
|
|
|
|
{
|
|
|
|
Regular,
|
|
|
|
Finished
|
|
|
|
};
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2019-03-01 10:38:16 +03:00
|
|
|
namespace Net
|
|
|
|
{
|
|
|
|
struct DownloadResult;
|
|
|
|
}
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
namespace BitTorrent
|
|
|
|
{
|
|
|
|
class InfoHash;
|
2019-10-01 10:33:11 +03:00
|
|
|
class MagnetUri;
|
2015-04-19 18:17:47 +03:00
|
|
|
class TorrentHandle;
|
2020-04-12 18:08:19 +03:00
|
|
|
class TorrentHandleImpl;
|
2015-04-19 18:17:47 +03:00
|
|
|
class Tracker;
|
|
|
|
class TrackerEntry;
|
2020-08-05 08:31:41 +03:00
|
|
|
struct LoadTorrentParams;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2020-02-14 08:18:15 +03:00
|
|
|
enum class MoveStorageMode;
|
|
|
|
|
2019-09-28 11:49:36 +03:00
|
|
|
// Using `Q_ENUM_NS()` without a wrapper namespace in our case is not advised
|
|
|
|
// since `Q_NAMESPACE` cannot be used when the same namespace resides at different files.
|
|
|
|
// https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/#comment-143779
|
|
|
|
namespace SessionSettingsEnums
|
2017-08-15 21:23:07 +03:00
|
|
|
{
|
2019-09-28 11:49:36 +03:00
|
|
|
Q_NAMESPACE
|
2017-08-15 21:23:07 +03:00
|
|
|
|
2019-10-01 10:33:11 +03:00
|
|
|
enum class BTProtocol : int
|
|
|
|
{
|
|
|
|
Both = 0,
|
|
|
|
TCP = 1,
|
|
|
|
UTP = 2
|
|
|
|
};
|
|
|
|
Q_ENUM_NS(BTProtocol)
|
|
|
|
|
2017-08-15 21:23:07 +03:00
|
|
|
enum class ChokingAlgorithm : int
|
|
|
|
{
|
|
|
|
FixedSlots = 0,
|
|
|
|
RateBased = 1
|
|
|
|
};
|
2019-09-28 11:49:36 +03:00
|
|
|
Q_ENUM_NS(ChokingAlgorithm)
|
2017-08-15 21:23:07 +03:00
|
|
|
|
|
|
|
enum class MixedModeAlgorithm : int
|
|
|
|
{
|
|
|
|
TCP = 0,
|
|
|
|
Proportional = 1
|
|
|
|
};
|
2019-09-28 11:49:36 +03:00
|
|
|
Q_ENUM_NS(MixedModeAlgorithm)
|
2017-09-13 23:29:54 +03:00
|
|
|
|
2019-10-01 10:33:11 +03:00
|
|
|
enum class SeedChokingAlgorithm : int
|
2017-09-13 23:29:54 +03:00
|
|
|
{
|
2019-10-01 10:33:11 +03:00
|
|
|
RoundRobin = 0,
|
|
|
|
FastestUpload = 1,
|
|
|
|
AntiLeech = 2
|
2017-09-13 23:29:54 +03:00
|
|
|
};
|
2019-10-01 10:33:11 +03:00
|
|
|
Q_ENUM_NS(SeedChokingAlgorithm)
|
2019-09-28 09:21:53 +03:00
|
|
|
|
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
enum class OSMemoryPriority : int
|
|
|
|
{
|
|
|
|
Normal = 0,
|
|
|
|
BelowNormal = 1,
|
|
|
|
Medium = 2,
|
|
|
|
Low = 3,
|
|
|
|
VeryLow = 4
|
|
|
|
};
|
|
|
|
Q_ENUM_NS(OSMemoryPriority)
|
|
|
|
#endif
|
2019-09-28 11:49:36 +03:00
|
|
|
}
|
|
|
|
using namespace SessionSettingsEnums;
|
2017-08-15 21:23:07 +03:00
|
|
|
|
2017-04-29 14:52:28 +03:00
|
|
|
struct SessionMetricIndices
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int hasIncomingConnections = 0;
|
|
|
|
int sentPayloadBytes = 0;
|
|
|
|
int recvPayloadBytes = 0;
|
|
|
|
int sentBytes = 0;
|
|
|
|
int recvBytes = 0;
|
|
|
|
int sentIPOverheadBytes = 0;
|
|
|
|
int recvIPOverheadBytes = 0;
|
|
|
|
int sentTrackerBytes = 0;
|
|
|
|
int recvTrackerBytes = 0;
|
|
|
|
int recvRedundantBytes = 0;
|
|
|
|
int recvFailedBytes = 0;
|
|
|
|
} net;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int numPeersConnected = 0;
|
|
|
|
int numPeersUpDisk = 0;
|
|
|
|
int numPeersDownDisk = 0;
|
|
|
|
} peer;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int dhtBytesIn = 0;
|
|
|
|
int dhtBytesOut = 0;
|
|
|
|
int dhtNodes = 0;
|
|
|
|
} dht;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int diskBlocksInUse = 0;
|
|
|
|
int numBlocksRead = 0;
|
|
|
|
int numBlocksCacheHits = 0;
|
2017-08-14 17:27:31 +03:00
|
|
|
int writeJobs = 0;
|
|
|
|
int readJobs = 0;
|
|
|
|
int hashJobs = 0;
|
2017-04-29 14:52:28 +03:00
|
|
|
int queuedDiskJobs = 0;
|
|
|
|
int diskJobTime = 0;
|
|
|
|
} disk;
|
|
|
|
};
|
|
|
|
|
2015-09-25 10:52:25 +03:00
|
|
|
class Session : public QObject
|
2015-04-19 18:17:47 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_DISABLE_COPY(Session)
|
|
|
|
|
|
|
|
public:
|
|
|
|
static void initInstance();
|
|
|
|
static void freeInstance();
|
|
|
|
static Session *instance();
|
|
|
|
|
2015-09-25 10:52:25 +03:00
|
|
|
QString defaultSavePath() const;
|
2016-02-09 11:56:48 +03:00
|
|
|
void setDefaultSavePath(QString path);
|
2015-09-25 10:52:25 +03:00
|
|
|
QString tempPath() const;
|
2016-02-09 11:56:48 +03:00
|
|
|
void setTempPath(QString path);
|
|
|
|
bool isTempPathEnabled() const;
|
|
|
|
void setTempPathEnabled(bool enabled);
|
2017-07-28 12:13:57 +03:00
|
|
|
QString torrentTempPath(const TorrentInfo &torrentInfo) const;
|
2016-02-09 11:56:48 +03:00
|
|
|
|
|
|
|
static bool isValidCategoryName(const QString &name);
|
|
|
|
// returns category itself and all top level categories
|
|
|
|
static QStringList expandCategory(const QString &category);
|
|
|
|
|
2019-10-01 11:23:32 +03:00
|
|
|
QStringMap categories() const;
|
2016-02-09 11:56:48 +03:00
|
|
|
QString categorySavePath(const QString &categoryName) const;
|
|
|
|
bool addCategory(const QString &name, const QString &savePath = "");
|
|
|
|
bool editCategory(const QString &name, const QString &savePath);
|
|
|
|
bool removeCategory(const QString &name);
|
|
|
|
bool isSubcategoriesEnabled() const;
|
|
|
|
void setSubcategoriesEnabled(bool value);
|
|
|
|
|
2017-06-05 03:22:17 +03:00
|
|
|
static bool isValidTag(const QString &tag);
|
|
|
|
QSet<QString> tags() const;
|
|
|
|
bool hasTag(const QString &tag) const;
|
|
|
|
bool addTag(const QString &tag);
|
|
|
|
bool removeTag(const QString &tag);
|
|
|
|
|
2016-05-08 22:47:50 +03:00
|
|
|
// Torrent Management Mode subsystem (TMM)
|
2016-02-09 11:56:48 +03:00
|
|
|
//
|
2016-05-08 22:47:50 +03:00
|
|
|
// Each torrent can be either in Manual mode or in Automatic mode
|
|
|
|
// In Manual Mode various torrent properties are set explicitly(eg save path)
|
|
|
|
// In Automatic Mode various torrent properties are set implicitly(eg save path)
|
|
|
|
// based on the associated category.
|
|
|
|
// In Automatic Mode torrent save path can be changed in following cases:
|
2016-02-09 11:56:48 +03:00
|
|
|
// 1. Default save path changed
|
|
|
|
// 2. Torrent category save path changed
|
|
|
|
// 3. Torrent category changed
|
|
|
|
// (unless otherwise is specified)
|
2016-05-08 22:47:50 +03:00
|
|
|
bool isAutoTMMDisabledByDefault() const;
|
|
|
|
void setAutoTMMDisabledByDefault(bool value);
|
|
|
|
bool isDisableAutoTMMWhenCategoryChanged() const;
|
|
|
|
void setDisableAutoTMMWhenCategoryChanged(bool value);
|
|
|
|
bool isDisableAutoTMMWhenDefaultSavePathChanged() const;
|
|
|
|
void setDisableAutoTMMWhenDefaultSavePathChanged(bool value);
|
|
|
|
bool isDisableAutoTMMWhenCategorySavePathChanged() const;
|
|
|
|
void setDisableAutoTMMWhenCategorySavePathChanged(bool value);
|
2016-02-09 11:56:48 +03:00
|
|
|
|
2016-05-01 11:05:52 +03:00
|
|
|
qreal globalMaxRatio() const;
|
|
|
|
void setGlobalMaxRatio(qreal ratio);
|
2016-02-07 20:31:50 +03:00
|
|
|
int globalMaxSeedingMinutes() const;
|
|
|
|
void setGlobalMaxSeedingMinutes(int minutes);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isDHTEnabled() const;
|
|
|
|
void setDHTEnabled(bool enabled);
|
|
|
|
bool isLSDEnabled() const;
|
|
|
|
void setLSDEnabled(bool enabled);
|
|
|
|
bool isPeXEnabled() const;
|
|
|
|
void setPeXEnabled(bool enabled);
|
2016-02-09 11:56:48 +03:00
|
|
|
bool isAddTorrentPaused() const;
|
|
|
|
void setAddTorrentPaused(bool value);
|
2020-04-28 18:10:30 +03:00
|
|
|
bool isKeepTorrentTopLevelFolder() const;
|
|
|
|
void setKeepTorrentTopLevelFolder(bool value);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isTrackerEnabled() const;
|
|
|
|
void setTrackerEnabled(bool enabled);
|
|
|
|
bool isAppendExtensionEnabled() const;
|
|
|
|
void setAppendExtensionEnabled(bool enabled);
|
2020-10-07 14:51:32 +03:00
|
|
|
int refreshInterval() const;
|
|
|
|
void setRefreshInterval(int value);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isPreallocationEnabled() const;
|
|
|
|
void setPreallocationEnabled(bool enabled);
|
|
|
|
QString torrentExportDirectory() const;
|
2016-10-31 03:22:51 +03:00
|
|
|
void setTorrentExportDirectory(QString path);
|
2016-05-01 11:05:52 +03:00
|
|
|
QString finishedTorrentExportDirectory() const;
|
2016-10-31 03:22:51 +03:00
|
|
|
void setFinishedTorrentExportDirectory(QString path);
|
2016-05-01 11:05:52 +03:00
|
|
|
|
|
|
|
int globalDownloadSpeedLimit() const;
|
|
|
|
void setGlobalDownloadSpeedLimit(int limit);
|
|
|
|
int globalUploadSpeedLimit() const;
|
|
|
|
void setGlobalUploadSpeedLimit(int limit);
|
|
|
|
int altGlobalDownloadSpeedLimit() const;
|
|
|
|
void setAltGlobalDownloadSpeedLimit(int limit);
|
|
|
|
int altGlobalUploadSpeedLimit() const;
|
|
|
|
void setAltGlobalUploadSpeedLimit(int limit);
|
|
|
|
int downloadSpeedLimit() const;
|
|
|
|
void setDownloadSpeedLimit(int limit);
|
|
|
|
int uploadSpeedLimit() const;
|
|
|
|
void setUploadSpeedLimit(int limit);
|
|
|
|
bool isAltGlobalSpeedLimitEnabled() const;
|
|
|
|
void setAltGlobalSpeedLimitEnabled(bool enabled);
|
|
|
|
bool isBandwidthSchedulerEnabled() const;
|
|
|
|
void setBandwidthSchedulerEnabled(bool enabled);
|
|
|
|
|
2020-10-07 14:51:32 +03:00
|
|
|
int saveResumeDataInterval() const;
|
|
|
|
void setSaveResumeDataInterval(int value);
|
2016-05-01 11:05:52 +03:00
|
|
|
int port() const;
|
|
|
|
void setPort(int port);
|
|
|
|
bool useRandomPort() const;
|
|
|
|
void setUseRandomPort(bool value);
|
|
|
|
QString networkInterface() const;
|
2020-10-30 01:25:19 +03:00
|
|
|
void setNetworkInterface(const QString &iface);
|
2016-10-31 02:40:26 +03:00
|
|
|
QString networkInterfaceName() const;
|
|
|
|
void setNetworkInterfaceName(const QString &name);
|
2016-05-01 11:05:52 +03:00
|
|
|
QString networkInterfaceAddress() const;
|
|
|
|
void setNetworkInterfaceAddress(const QString &address);
|
|
|
|
int encryption() const;
|
|
|
|
void setEncryption(int state);
|
|
|
|
bool isProxyPeerConnectionsEnabled() const;
|
|
|
|
void setProxyPeerConnectionsEnabled(bool enabled);
|
2017-08-15 21:23:07 +03:00
|
|
|
ChokingAlgorithm chokingAlgorithm() const;
|
|
|
|
void setChokingAlgorithm(ChokingAlgorithm mode);
|
|
|
|
SeedChokingAlgorithm seedChokingAlgorithm() const;
|
|
|
|
void setSeedChokingAlgorithm(SeedChokingAlgorithm mode);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isAddTrackersEnabled() const;
|
|
|
|
void setAddTrackersEnabled(bool enabled);
|
|
|
|
QString additionalTrackers() const;
|
|
|
|
void setAdditionalTrackers(const QString &trackers);
|
2016-10-29 19:14:27 +03:00
|
|
|
bool isIPFilteringEnabled() const;
|
|
|
|
void setIPFilteringEnabled(bool enabled);
|
2016-05-01 11:05:52 +03:00
|
|
|
QString IPFilterFile() const;
|
|
|
|
void setIPFilterFile(QString path);
|
|
|
|
bool announceToAllTrackers() const;
|
|
|
|
void setAnnounceToAllTrackers(bool val);
|
2017-10-30 21:04:14 +03:00
|
|
|
bool announceToAllTiers() const;
|
|
|
|
void setAnnounceToAllTiers(bool val);
|
2020-08-15 20:29:30 +03:00
|
|
|
int peerTurnover() const;
|
|
|
|
void setPeerTurnover(int num);
|
|
|
|
int peerTurnoverCutoff() const;
|
|
|
|
void setPeerTurnoverCutoff(int num);
|
|
|
|
int peerTurnoverInterval() const;
|
|
|
|
void setPeerTurnoverInterval(int num);
|
2018-06-18 19:10:57 +03:00
|
|
|
int asyncIOThreads() const;
|
|
|
|
void setAsyncIOThreads(int num);
|
2020-10-10 08:07:04 +03:00
|
|
|
int hashingThreads() const;
|
|
|
|
void setHashingThreads(int num);
|
2019-07-03 12:44:16 +03:00
|
|
|
int filePoolSize() const;
|
|
|
|
void setFilePoolSize(int size);
|
2018-08-28 13:18:07 +03:00
|
|
|
int checkingMemUsage() const;
|
|
|
|
void setCheckingMemUsage(int size);
|
2017-08-18 03:05:36 +03:00
|
|
|
int diskCacheSize() const;
|
|
|
|
void setDiskCacheSize(int size);
|
2017-08-18 20:20:53 +03:00
|
|
|
int diskCacheTTL() const;
|
|
|
|
void setDiskCacheTTL(int ttl);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool useOSCache() const;
|
|
|
|
void setUseOSCache(bool use);
|
2018-01-29 12:03:14 +03:00
|
|
|
bool isCoalesceReadWriteEnabled() const;
|
|
|
|
void setCoalesceReadWriteEnabled(bool enabled);
|
2020-01-13 03:11:29 +03:00
|
|
|
bool usePieceExtentAffinity() const;
|
|
|
|
void setPieceExtentAffinity(bool enabled);
|
2017-08-11 14:15:18 +03:00
|
|
|
bool isSuggestModeEnabled() const;
|
|
|
|
void setSuggestMode(bool mode);
|
2017-08-11 14:48:58 +03:00
|
|
|
int sendBufferWatermark() const;
|
|
|
|
void setSendBufferWatermark(int value);
|
|
|
|
int sendBufferLowWatermark() const;
|
|
|
|
void setSendBufferLowWatermark(int value);
|
|
|
|
int sendBufferWatermarkFactor() const;
|
|
|
|
void setSendBufferWatermarkFactor(int value);
|
2019-07-02 07:03:44 +03:00
|
|
|
int socketBacklogSize() const;
|
|
|
|
void setSocketBacklogSize(int value);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isAnonymousModeEnabled() const;
|
|
|
|
void setAnonymousModeEnabled(bool enabled);
|
|
|
|
bool isQueueingSystemEnabled() const;
|
|
|
|
void setQueueingSystemEnabled(bool enabled);
|
|
|
|
bool ignoreSlowTorrentsForQueueing() const;
|
|
|
|
void setIgnoreSlowTorrentsForQueueing(bool ignore);
|
2018-02-02 14:22:24 +03:00
|
|
|
int downloadRateForSlowTorrents() const;
|
|
|
|
void setDownloadRateForSlowTorrents(int rateInKibiBytes);
|
|
|
|
int uploadRateForSlowTorrents() const;
|
|
|
|
void setUploadRateForSlowTorrents(int rateInKibiBytes);
|
|
|
|
int slowTorrentsInactivityTimer() const;
|
|
|
|
void setSlowTorrentsInactivityTimer(int timeInSeconds);
|
2017-08-18 20:20:53 +03:00
|
|
|
int outgoingPortsMin() const;
|
|
|
|
void setOutgoingPortsMin(int min);
|
|
|
|
int outgoingPortsMax() const;
|
|
|
|
void setOutgoingPortsMax(int max);
|
2020-03-28 07:32:07 +03:00
|
|
|
int UPnPLeaseDuration() const;
|
|
|
|
void setUPnPLeaseDuration(int duration);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool ignoreLimitsOnLAN() const;
|
|
|
|
void setIgnoreLimitsOnLAN(bool ignore);
|
|
|
|
bool includeOverheadInLimits() const;
|
|
|
|
void setIncludeOverheadInLimits(bool include);
|
2016-10-31 02:22:11 +03:00
|
|
|
QString announceIP() const;
|
|
|
|
void setAnnounceIP(const QString &ip);
|
2020-09-03 06:24:30 +03:00
|
|
|
int maxConcurrentHTTPAnnounces() const;
|
|
|
|
void setMaxConcurrentHTTPAnnounces(int value);
|
2020-01-09 15:43:06 +03:00
|
|
|
int stopTrackerTimeout() const;
|
|
|
|
void setStopTrackerTimeout(int value);
|
2016-05-01 11:05:52 +03:00
|
|
|
int maxConnections() const;
|
|
|
|
void setMaxConnections(int max);
|
|
|
|
int maxConnectionsPerTorrent() const;
|
|
|
|
void setMaxConnectionsPerTorrent(int max);
|
|
|
|
int maxUploads() const;
|
|
|
|
void setMaxUploads(int max);
|
|
|
|
int maxUploadsPerTorrent() const;
|
|
|
|
void setMaxUploadsPerTorrent(int max);
|
|
|
|
int maxActiveDownloads() const;
|
|
|
|
void setMaxActiveDownloads(int max);
|
|
|
|
int maxActiveUploads() const;
|
|
|
|
void setMaxActiveUploads(int max);
|
|
|
|
int maxActiveTorrents() const;
|
|
|
|
void setMaxActiveTorrents(int max);
|
2017-09-13 23:29:54 +03:00
|
|
|
BTProtocol btProtocol() const;
|
|
|
|
void setBTProtocol(BTProtocol protocol);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isUTPRateLimited() const;
|
|
|
|
void setUTPRateLimited(bool limited);
|
2017-08-15 21:23:07 +03:00
|
|
|
MixedModeAlgorithm utpMixedMode() const;
|
|
|
|
void setUtpMixedMode(MixedModeAlgorithm mode);
|
2020-12-01 05:53:48 +03:00
|
|
|
bool isIDNSupportEnabled() const;
|
|
|
|
void setIDNSupportEnabled(bool enabled);
|
2017-08-11 11:37:32 +03:00
|
|
|
bool multiConnectionsPerIpEnabled() const;
|
|
|
|
void setMultiConnectionsPerIpEnabled(bool enabled);
|
2020-04-22 22:50:13 +03:00
|
|
|
bool validateHTTPSTrackerCertificate() const;
|
|
|
|
void setValidateHTTPSTrackerCertificate(bool enabled);
|
2020-09-21 05:46:28 +03:00
|
|
|
bool blockPeersOnPrivilegedPorts() const;
|
|
|
|
void setBlockPeersOnPrivilegedPorts(bool enabled);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isTrackerFilteringEnabled() const;
|
|
|
|
void setTrackerFilteringEnabled(bool enabled);
|
2017-03-06 15:40:34 +03:00
|
|
|
QStringList bannedIPs() const;
|
2017-05-09 08:55:24 +03:00
|
|
|
void setBannedIPs(const QStringList &newList);
|
2019-09-28 09:21:53 +03:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
OSMemoryPriority getOSMemoryPriority() const;
|
|
|
|
void setOSMemoryPriority(OSMemoryPriority priority);
|
|
|
|
#endif
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2017-04-14 01:43:09 +03:00
|
|
|
void startUpTorrents();
|
2015-04-19 18:17:47 +03:00
|
|
|
TorrentHandle *findTorrent(const InfoHash &hash) const;
|
2020-04-12 18:08:19 +03:00
|
|
|
QVector<TorrentHandle *> torrents() const;
|
2015-04-19 18:17:47 +03:00
|
|
|
bool hasActiveTorrents() const;
|
|
|
|
bool hasUnfinishedTorrents() const;
|
2018-08-02 22:45:21 +03:00
|
|
|
bool hasRunningSeed() const;
|
2017-04-29 14:45:30 +03:00
|
|
|
const SessionStatus &status() const;
|
|
|
|
const CacheStatus &cacheStatus() const;
|
2015-04-19 18:17:47 +03:00
|
|
|
quint64 getAlltimeDL() const;
|
|
|
|
quint64 getAlltimeUL() const;
|
|
|
|
bool isListening() const;
|
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
MaxRatioAction maxRatioAction() const;
|
|
|
|
void setMaxRatioAction(MaxRatioAction act);
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
void banIP(const QString &ip);
|
|
|
|
|
|
|
|
bool isKnownTorrent(const InfoHash &hash) const;
|
2018-12-28 08:38:08 +03:00
|
|
|
bool addTorrent(const QString &source, const AddTorrentParams ¶ms = AddTorrentParams());
|
2020-08-05 08:31:41 +03:00
|
|
|
bool addTorrent(const MagnetUri &magnetUri, const AddTorrentParams ¶ms = AddTorrentParams());
|
2015-04-19 18:17:47 +03:00
|
|
|
bool addTorrent(const TorrentInfo &torrentInfo, const AddTorrentParams ¶ms = AddTorrentParams());
|
2019-09-29 04:47:06 +03:00
|
|
|
bool deleteTorrent(const InfoHash &hash, DeleteOption deleteOption = Torrent);
|
2020-11-21 15:16:21 +03:00
|
|
|
bool downloadMetadata(const MagnetUri &magnetUri);
|
|
|
|
bool cancelDownloadMetadata(const InfoHash &hash);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
void recursiveTorrentDownload(const InfoHash &hash);
|
2019-10-02 07:52:51 +03:00
|
|
|
void increaseTorrentsQueuePos(const QVector<InfoHash> &hashes);
|
|
|
|
void decreaseTorrentsQueuePos(const QVector<InfoHash> &hashes);
|
|
|
|
void topTorrentsQueuePos(const QVector<InfoHash> &hashes);
|
|
|
|
void bottomTorrentsQueuePos(const QVector<InfoHash> &hashes);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2015-09-25 10:52:25 +03:00
|
|
|
// TorrentHandle interface
|
2020-04-12 18:08:19 +03:00
|
|
|
void handleTorrentSaveResumeDataRequested(const TorrentHandleImpl *torrent);
|
|
|
|
void handleTorrentShareLimitChanged(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentNameChanged(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentSavePathChanged(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentCategoryChanged(TorrentHandleImpl *const torrent, const QString &oldCategory);
|
|
|
|
void handleTorrentTagAdded(TorrentHandleImpl *const torrent, const QString &tag);
|
|
|
|
void handleTorrentTagRemoved(TorrentHandleImpl *const torrent, const QString &tag);
|
|
|
|
void handleTorrentSavingModeChanged(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentMetadataReceived(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentPaused(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentResumed(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentChecked(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentFinished(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentTrackersAdded(TorrentHandleImpl *const torrent, const QVector<TrackerEntry> &newTrackers);
|
|
|
|
void handleTorrentTrackersRemoved(TorrentHandleImpl *const torrent, const QVector<TrackerEntry> &deletedTrackers);
|
|
|
|
void handleTorrentTrackersChanged(TorrentHandleImpl *const torrent);
|
|
|
|
void handleTorrentUrlSeedsAdded(TorrentHandleImpl *const torrent, const QVector<QUrl> &newUrlSeeds);
|
|
|
|
void handleTorrentUrlSeedsRemoved(TorrentHandleImpl *const torrent, const QVector<QUrl> &urlSeeds);
|
|
|
|
void handleTorrentResumeDataReady(TorrentHandleImpl *const torrent, const std::shared_ptr<lt::entry> &data);
|
|
|
|
void handleTorrentTrackerReply(TorrentHandleImpl *const torrent, const QString &trackerUrl);
|
|
|
|
void handleTorrentTrackerWarning(TorrentHandleImpl *const torrent, const QString &trackerUrl);
|
|
|
|
void handleTorrentTrackerError(TorrentHandleImpl *const torrent, const QString &trackerUrl);
|
|
|
|
|
|
|
|
bool addMoveTorrentStorageJob(TorrentHandleImpl *torrent, const QString &newPath, MoveStorageMode mode);
|
2020-02-14 08:18:15 +03:00
|
|
|
|
2020-12-02 09:16:11 +03:00
|
|
|
void findIncompleteFiles(const TorrentInfo &torrentInfo, const QString &savePath) const;
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
signals:
|
2019-09-18 10:48:41 +03:00
|
|
|
void allTorrentsFinished();
|
|
|
|
void categoryAdded(const QString &categoryName);
|
|
|
|
void categoryRemoved(const QString &categoryName);
|
|
|
|
void downloadFromUrlFailed(const QString &url, const QString &reason);
|
|
|
|
void downloadFromUrlFinished(const QString &url);
|
2020-09-25 09:50:04 +03:00
|
|
|
void fullDiskError(TorrentHandle *torrent, const QString &msg);
|
2019-09-18 10:48:41 +03:00
|
|
|
void IPFilterParsed(bool error, int ruleCount);
|
2020-08-05 08:31:41 +03:00
|
|
|
void loadTorrentFailed(const QString &error);
|
2020-11-21 15:16:21 +03:00
|
|
|
void metadataDownloaded(const TorrentInfo &info);
|
2020-09-25 09:50:04 +03:00
|
|
|
void recursiveTorrentDownloadPossible(TorrentHandle *torrent);
|
2019-09-18 10:48:41 +03:00
|
|
|
void speedLimitModeChanged(bool alternative);
|
|
|
|
void statsUpdated();
|
|
|
|
void subcategoriesSupportChanged();
|
|
|
|
void tagAdded(const QString &tag);
|
|
|
|
void tagRemoved(const QString &tag);
|
2020-09-25 09:50:04 +03:00
|
|
|
void torrentAboutToBeRemoved(TorrentHandle *torrent);
|
|
|
|
void torrentAdded(TorrentHandle *torrent);
|
|
|
|
void torrentCategoryChanged(TorrentHandle *torrent, const QString &oldCategory);
|
|
|
|
void torrentFinished(TorrentHandle *torrent);
|
|
|
|
void torrentFinishedChecking(TorrentHandle *torrent);
|
|
|
|
void torrentLoaded(TorrentHandle *torrent);
|
2020-12-02 09:16:11 +03:00
|
|
|
void torrentMetadataReceived(TorrentHandle *torrent);
|
2020-09-25 09:50:04 +03:00
|
|
|
void torrentPaused(TorrentHandle *torrent);
|
|
|
|
void torrentResumed(TorrentHandle *torrent);
|
|
|
|
void torrentSavePathChanged(TorrentHandle *torrent);
|
|
|
|
void torrentSavingModeChanged(TorrentHandle *torrent);
|
|
|
|
void torrentStorageMoveFailed(TorrentHandle *torrent, const QString &targetPath, const QString &error);
|
|
|
|
void torrentStorageMoveFinished(TorrentHandle *torrent, const QString &newPath);
|
2020-09-25 09:37:00 +03:00
|
|
|
void torrentsUpdated(const QVector<TorrentHandle *> &torrents);
|
2020-09-25 09:50:04 +03:00
|
|
|
void torrentTagAdded(TorrentHandle *torrent, const QString &tag);
|
|
|
|
void torrentTagRemoved(TorrentHandle *torrent, const QString &tag);
|
|
|
|
void trackerError(TorrentHandle *torrent, const QString &tracker);
|
|
|
|
void trackerlessStateChanged(TorrentHandle *torrent, bool trackerless);
|
|
|
|
void trackersAdded(TorrentHandle *torrent, const QVector<TrackerEntry> &trackers);
|
|
|
|
void trackersChanged(TorrentHandle *torrent);
|
|
|
|
void trackersRemoved(TorrentHandle *torrent, const QVector<TrackerEntry> &trackers);
|
|
|
|
void trackerSuccess(TorrentHandle *torrent, const QString &tracker);
|
|
|
|
void trackerWarning(TorrentHandle *torrent, const QString &tracker);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
private slots:
|
2016-05-01 11:05:52 +03:00
|
|
|
void configureDeferred();
|
2015-04-19 18:17:47 +03:00
|
|
|
void readAlerts();
|
2020-07-26 11:21:56 +03:00
|
|
|
void enqueueRefresh();
|
2016-02-07 20:31:50 +03:00
|
|
|
void processShareLimits();
|
2020-04-19 16:12:50 +03:00
|
|
|
void generateResumeData();
|
2015-04-19 18:17:47 +03:00
|
|
|
void handleIPFilterParsed(int ruleCount);
|
|
|
|
void handleIPFilterError();
|
2019-03-01 10:38:16 +03:00
|
|
|
void handleDownloadFinished(const Net::DownloadResult &result);
|
2020-12-02 09:16:11 +03:00
|
|
|
void fileSearchFinished(const InfoHash &id, const QString &savePath, const QStringList &fileNames);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2015-06-15 01:06:56 +03:00
|
|
|
// Session reconfiguration triggers
|
2019-02-09 18:40:14 +03:00
|
|
|
void networkOnlineStateChanged(bool online);
|
2019-10-01 10:33:11 +03:00
|
|
|
void networkConfigurationChange(const QNetworkConfiguration &);
|
2015-06-15 01:06:56 +03:00
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
private:
|
2020-02-14 08:18:15 +03:00
|
|
|
struct MoveStorageJob
|
|
|
|
{
|
2020-05-08 14:42:02 +03:00
|
|
|
lt::torrent_handle torrentHandle;
|
2020-02-14 08:18:15 +03:00
|
|
|
QString path;
|
|
|
|
MoveStorageMode mode;
|
|
|
|
};
|
|
|
|
|
2017-09-14 19:55:14 +03:00
|
|
|
struct RemovingTorrentData
|
|
|
|
{
|
|
|
|
QString name;
|
2020-05-11 19:08:27 +03:00
|
|
|
QString pathToRemove;
|
2019-09-18 19:26:01 +03:00
|
|
|
DeleteOption deleteOption;
|
2017-09-14 19:55:14 +03:00
|
|
|
};
|
|
|
|
|
2018-04-15 13:06:31 +03:00
|
|
|
explicit Session(QObject *parent = nullptr);
|
2015-04-19 18:17:47 +03:00
|
|
|
~Session();
|
|
|
|
|
|
|
|
bool hasPerTorrentRatioLimit() const;
|
2016-02-07 20:31:50 +03:00
|
|
|
bool hasPerTorrentSeedingTimeLimit() const;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
void initResumeFolder();
|
|
|
|
|
|
|
|
// Session configuration
|
2016-05-01 11:05:52 +03:00
|
|
|
Q_INVOKABLE void configure();
|
2019-10-01 10:05:26 +03:00
|
|
|
void configureComponents();
|
|
|
|
void initializeNativeSession();
|
|
|
|
void loadLTSettings(lt::settings_pack &settingsPack);
|
2019-12-06 03:24:49 +03:00
|
|
|
void configureNetworkInterfaces(lt::settings_pack &settingsPack);
|
2017-05-01 19:19:34 +03:00
|
|
|
void configurePeerClasses();
|
2020-10-07 14:27:46 +03:00
|
|
|
void adjustLimits(lt::settings_pack &settingsPack) const;
|
2019-06-02 09:33:46 +03:00
|
|
|
void applyBandwidthLimits(lt::settings_pack &settingsPack) const;
|
2017-04-29 14:52:28 +03:00
|
|
|
void initMetrics();
|
2016-06-03 17:03:17 +03:00
|
|
|
void adjustLimits();
|
2017-08-20 18:00:23 +03:00
|
|
|
void applyBandwidthLimits();
|
2019-05-09 07:45:52 +03:00
|
|
|
void processBannedIPs(lt::ip_filter &filter);
|
2019-10-16 18:38:51 +03:00
|
|
|
QStringList getListeningIPs() const;
|
2016-05-01 11:05:52 +03:00
|
|
|
void configureListeningInterface();
|
|
|
|
void enableTracker(bool enable);
|
|
|
|
void enableBandwidthScheduler();
|
|
|
|
void populateAdditionalTrackers();
|
2016-06-03 17:03:17 +03:00
|
|
|
void enableIPFilter();
|
|
|
|
void disableIPFilter();
|
2019-09-28 09:21:53 +03:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
void applyOSMemoryPriority() const;
|
|
|
|
#endif
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2020-08-05 08:31:41 +03:00
|
|
|
bool loadTorrentResumeData(const QByteArray &data, const TorrentInfo &metadata, LoadTorrentParams &torrentParams);
|
|
|
|
bool loadTorrent(LoadTorrentParams params);
|
|
|
|
LoadTorrentParams initLoadTorrentParams(const AddTorrentParams &addTorrentParams);
|
|
|
|
bool addTorrent_impl(const AddTorrentParams &addTorrentParams, const MagnetUri &magnetUri, TorrentInfo torrentInfo = TorrentInfo());
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2016-02-07 20:31:50 +03:00
|
|
|
void updateSeedingLimitTimer();
|
2020-04-12 18:08:19 +03:00
|
|
|
void exportTorrentFile(const TorrentHandle *torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2019-05-09 07:45:52 +03:00
|
|
|
void handleAlert(const lt::alert *a);
|
|
|
|
void dispatchTorrentAlert(const lt::alert *a);
|
|
|
|
void handleAddTorrentAlert(const lt::add_torrent_alert *p);
|
|
|
|
void handleStateUpdateAlert(const lt::state_update_alert *p);
|
|
|
|
void handleMetadataReceivedAlert(const lt::metadata_received_alert *p);
|
|
|
|
void handleFileErrorAlert(const lt::file_error_alert *p);
|
|
|
|
void handleTorrentRemovedAlert(const lt::torrent_removed_alert *p);
|
|
|
|
void handleTorrentDeletedAlert(const lt::torrent_deleted_alert *p);
|
|
|
|
void handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed_alert *p);
|
|
|
|
void handlePortmapWarningAlert(const lt::portmap_error_alert *p);
|
|
|
|
void handlePortmapAlert(const lt::portmap_alert *p);
|
|
|
|
void handlePeerBlockedAlert(const lt::peer_blocked_alert *p);
|
|
|
|
void handlePeerBanAlert(const lt::peer_ban_alert *p);
|
|
|
|
void handleUrlSeedAlert(const lt::url_seed_alert *p);
|
|
|
|
void handleListenSucceededAlert(const lt::listen_succeeded_alert *p);
|
|
|
|
void handleListenFailedAlert(const lt::listen_failed_alert *p);
|
|
|
|
void handleExternalIPAlert(const lt::external_ip_alert *p);
|
|
|
|
void handleSessionStatsAlert(const lt::session_stats_alert *p);
|
2019-09-13 07:31:26 +03:00
|
|
|
void handleAlertsDroppedAlert(const lt::alerts_dropped_alert *p) const;
|
2020-02-14 08:18:15 +03:00
|
|
|
void handleStorageMovedAlert(const lt::storage_moved_alert *p);
|
|
|
|
void handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert *p);
|
2020-03-24 09:10:47 +03:00
|
|
|
void handleSocks5Alert(const lt::socks5_alert *p) const;
|
2019-05-09 07:45:52 +03:00
|
|
|
|
|
|
|
void createTorrentHandle(const lt::torrent_handle &nativeHandle);
|
2016-01-20 09:57:02 +03:00
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
void saveResumeData();
|
2018-11-19 12:53:29 +03:00
|
|
|
void saveTorrentsQueue();
|
|
|
|
void removeTorrentsQueue();
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2019-10-27 08:46:52 +03:00
|
|
|
std::vector<lt::alert *> getPendingAlerts(lt::time_duration time = lt::time_duration::zero()) const;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2020-02-14 08:18:15 +03:00
|
|
|
void moveTorrentStorage(const MoveStorageJob &job) const;
|
2020-07-15 15:46:09 +03:00
|
|
|
void handleMoveTorrentStorageJobFinished();
|
2020-02-14 08:18:15 +03:00
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
// BitTorrent
|
2019-10-01 10:33:11 +03:00
|
|
|
lt::session *m_nativeSession = nullptr;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2019-10-01 10:33:11 +03:00
|
|
|
bool m_deferredConfigureScheduled = false;
|
2019-10-29 18:16:22 +03:00
|
|
|
bool m_IPFilteringConfigured = false;
|
|
|
|
bool m_listenInterfaceConfigured = false;
|
2019-01-08 15:52:12 +03:00
|
|
|
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isDHTEnabled;
|
|
|
|
CachedSettingValue<bool> m_isLSDEnabled;
|
|
|
|
CachedSettingValue<bool> m_isPeXEnabled;
|
2016-10-29 19:14:27 +03:00
|
|
|
CachedSettingValue<bool> m_isIPFilteringEnabled;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isTrackerFilteringEnabled;
|
|
|
|
CachedSettingValue<QString> m_IPFilterFile;
|
|
|
|
CachedSettingValue<bool> m_announceToAllTrackers;
|
2017-10-30 21:04:14 +03:00
|
|
|
CachedSettingValue<bool> m_announceToAllTiers;
|
2018-06-18 19:10:57 +03:00
|
|
|
CachedSettingValue<int> m_asyncIOThreads;
|
2020-10-10 08:07:04 +03:00
|
|
|
CachedSettingValue<int> m_hashingThreads;
|
2019-07-03 12:44:16 +03:00
|
|
|
CachedSettingValue<int> m_filePoolSize;
|
2018-08-28 13:18:07 +03:00
|
|
|
CachedSettingValue<int> m_checkingMemUsage;
|
2017-08-18 03:05:36 +03:00
|
|
|
CachedSettingValue<int> m_diskCacheSize;
|
2017-08-18 20:20:53 +03:00
|
|
|
CachedSettingValue<int> m_diskCacheTTL;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_useOSCache;
|
2018-01-29 12:03:14 +03:00
|
|
|
CachedSettingValue<bool> m_coalesceReadWriteEnabled;
|
2020-01-13 03:11:29 +03:00
|
|
|
CachedSettingValue<bool> m_usePieceExtentAffinity;
|
2017-08-11 14:15:18 +03:00
|
|
|
CachedSettingValue<bool> m_isSuggestMode;
|
2017-08-11 14:48:58 +03:00
|
|
|
CachedSettingValue<int> m_sendBufferWatermark;
|
|
|
|
CachedSettingValue<int> m_sendBufferLowWatermark;
|
|
|
|
CachedSettingValue<int> m_sendBufferWatermarkFactor;
|
2019-07-02 07:03:44 +03:00
|
|
|
CachedSettingValue<int> m_socketBacklogSize;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isAnonymousModeEnabled;
|
|
|
|
CachedSettingValue<bool> m_isQueueingEnabled;
|
|
|
|
CachedSettingValue<int> m_maxActiveDownloads;
|
|
|
|
CachedSettingValue<int> m_maxActiveUploads;
|
|
|
|
CachedSettingValue<int> m_maxActiveTorrents;
|
|
|
|
CachedSettingValue<bool> m_ignoreSlowTorrentsForQueueing;
|
2018-02-02 14:22:24 +03:00
|
|
|
CachedSettingValue<int> m_downloadRateForSlowTorrents;
|
|
|
|
CachedSettingValue<int> m_uploadRateForSlowTorrents;
|
|
|
|
CachedSettingValue<int> m_slowTorrentsInactivityTimer;
|
2017-08-18 20:20:53 +03:00
|
|
|
CachedSettingValue<int> m_outgoingPortsMin;
|
|
|
|
CachedSettingValue<int> m_outgoingPortsMax;
|
2020-03-28 07:32:07 +03:00
|
|
|
CachedSettingValue<int> m_UPnPLeaseDuration;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_ignoreLimitsOnLAN;
|
|
|
|
CachedSettingValue<bool> m_includeOverheadInLimits;
|
2016-10-31 02:22:11 +03:00
|
|
|
CachedSettingValue<QString> m_announceIP;
|
2020-09-03 06:24:30 +03:00
|
|
|
CachedSettingValue<int> m_maxConcurrentHTTPAnnounces;
|
2020-01-09 15:43:06 +03:00
|
|
|
CachedSettingValue<int> m_stopTrackerTimeout;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<int> m_maxConnections;
|
|
|
|
CachedSettingValue<int> m_maxUploads;
|
|
|
|
CachedSettingValue<int> m_maxConnectionsPerTorrent;
|
|
|
|
CachedSettingValue<int> m_maxUploadsPerTorrent;
|
2017-09-13 23:29:54 +03:00
|
|
|
CachedSettingValue<BTProtocol> m_btProtocol;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isUTPRateLimited;
|
2017-08-15 21:23:07 +03:00
|
|
|
CachedSettingValue<MixedModeAlgorithm> m_utpMixedMode;
|
2020-12-01 05:53:48 +03:00
|
|
|
CachedSettingValue<bool> m_IDNSupportEnabled;
|
2017-08-11 11:37:32 +03:00
|
|
|
CachedSettingValue<bool> m_multiConnectionsPerIpEnabled;
|
2020-04-22 22:50:13 +03:00
|
|
|
CachedSettingValue<bool> m_validateHTTPSTrackerCertificate;
|
2020-09-21 05:46:28 +03:00
|
|
|
CachedSettingValue<bool> m_blockPeersOnPrivilegedPorts;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isAddTrackersEnabled;
|
|
|
|
CachedSettingValue<QString> m_additionalTrackers;
|
|
|
|
CachedSettingValue<qreal> m_globalMaxRatio;
|
2016-02-07 20:31:50 +03:00
|
|
|
CachedSettingValue<int> m_globalMaxSeedingMinutes;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isAddTorrentPaused;
|
2020-04-28 18:10:30 +03:00
|
|
|
CachedSettingValue<bool> m_isKeepTorrentTopLevelFolder;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
2020-10-07 14:51:32 +03:00
|
|
|
CachedSettingValue<int> m_refreshInterval;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isPreallocationEnabled;
|
|
|
|
CachedSettingValue<QString> m_torrentExportDirectory;
|
|
|
|
CachedSettingValue<QString> m_finishedTorrentExportDirectory;
|
|
|
|
CachedSettingValue<int> m_globalDownloadSpeedLimit;
|
|
|
|
CachedSettingValue<int> m_globalUploadSpeedLimit;
|
|
|
|
CachedSettingValue<int> m_altGlobalDownloadSpeedLimit;
|
|
|
|
CachedSettingValue<int> m_altGlobalUploadSpeedLimit;
|
|
|
|
CachedSettingValue<bool> m_isAltGlobalSpeedLimitEnabled;
|
|
|
|
CachedSettingValue<bool> m_isBandwidthSchedulerEnabled;
|
2020-10-07 14:51:32 +03:00
|
|
|
CachedSettingValue<int> m_saveResumeDataInterval;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<int> m_port;
|
|
|
|
CachedSettingValue<bool> m_useRandomPort;
|
|
|
|
CachedSettingValue<QString> m_networkInterface;
|
2016-10-31 02:40:26 +03:00
|
|
|
CachedSettingValue<QString> m_networkInterfaceName;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<QString> m_networkInterfaceAddress;
|
|
|
|
CachedSettingValue<int> m_encryption;
|
|
|
|
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
|
2017-08-15 21:23:07 +03:00
|
|
|
CachedSettingValue<ChokingAlgorithm> m_chokingAlgorithm;
|
|
|
|
CachedSettingValue<SeedChokingAlgorithm> m_seedChokingAlgorithm;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<QVariantMap> m_storedCategories;
|
2017-06-05 03:22:17 +03:00
|
|
|
CachedSettingValue<QStringList> m_storedTags;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<int> m_maxRatioAction;
|
|
|
|
CachedSettingValue<QString> m_defaultSavePath;
|
|
|
|
CachedSettingValue<QString> m_tempPath;
|
|
|
|
CachedSettingValue<bool> m_isSubcategoriesEnabled;
|
|
|
|
CachedSettingValue<bool> m_isTempPathEnabled;
|
|
|
|
CachedSettingValue<bool> m_isAutoTMMDisabledByDefault;
|
|
|
|
CachedSettingValue<bool> m_isDisableAutoTMMWhenCategoryChanged;
|
|
|
|
CachedSettingValue<bool> m_isDisableAutoTMMWhenDefaultSavePathChanged;
|
|
|
|
CachedSettingValue<bool> m_isDisableAutoTMMWhenCategorySavePathChanged;
|
|
|
|
CachedSettingValue<bool> m_isTrackerEnabled;
|
2020-08-15 20:29:30 +03:00
|
|
|
CachedSettingValue<int> m_peerTurnover;
|
|
|
|
CachedSettingValue<int> m_peerTurnoverCutoff;
|
|
|
|
CachedSettingValue<int> m_peerTurnoverInterval;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<QStringList> m_bannedIPs;
|
2019-09-28 09:21:53 +03:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
CachedSettingValue<OSMemoryPriority> m_OSMemoryPriority;
|
|
|
|
#endif
|
2016-05-01 11:05:52 +03:00
|
|
|
|
2017-01-19 02:13:55 +03:00
|
|
|
// Order is important. This needs to be declared after its CachedSettingsValue
|
|
|
|
// counterpart, because it uses it for initialization in the constructor
|
2016-10-31 03:06:29 +03:00
|
|
|
// initialization list.
|
2019-10-01 10:33:11 +03:00
|
|
|
const bool m_wasPexEnabled = m_isPeXEnabled;
|
2016-10-31 03:06:29 +03:00
|
|
|
|
2019-10-01 10:33:11 +03:00
|
|
|
int m_numResumeData = 0;
|
|
|
|
int m_extraLimit = 0;
|
2020-09-25 09:37:00 +03:00
|
|
|
QVector<TrackerEntry> m_additionalTrackerList;
|
2015-04-19 18:17:47 +03:00
|
|
|
QString m_resumeFolderPath;
|
2019-10-01 10:33:11 +03:00
|
|
|
QFile *m_resumeFolderLock = nullptr;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2020-07-26 11:21:56 +03:00
|
|
|
bool m_refreshEnqueued = false;
|
2019-10-01 10:33:11 +03:00
|
|
|
QTimer *m_seedingLimitTimer = nullptr;
|
|
|
|
QTimer *m_resumeDataTimer = nullptr;
|
|
|
|
Statistics *m_statistics = nullptr;
|
2015-04-19 18:17:47 +03:00
|
|
|
// IP filtering
|
|
|
|
QPointer<FilterParserThread> m_filterParser;
|
|
|
|
QPointer<BandwidthScheduler> m_bwScheduler;
|
|
|
|
// Tracker
|
|
|
|
QPointer<Tracker> m_tracker;
|
2015-12-13 15:38:19 +03:00
|
|
|
// fastresume data writing thread
|
2019-10-01 10:33:11 +03:00
|
|
|
QThread *m_ioThread = nullptr;
|
|
|
|
ResumeDataSavingManager *m_resumeDataSavingManager = nullptr;
|
2020-12-02 09:16:11 +03:00
|
|
|
FileSearcher *m_fileSearcher = nullptr;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2020-11-21 15:16:21 +03:00
|
|
|
QSet<InfoHash> m_downloadedMetadata;
|
2020-08-05 08:31:41 +03:00
|
|
|
|
2020-04-12 18:08:19 +03:00
|
|
|
QHash<InfoHash, TorrentHandleImpl *> m_torrents;
|
2020-08-05 08:31:41 +03:00
|
|
|
QHash<InfoHash, LoadTorrentParams> m_loadingTorrents;
|
2015-04-19 18:17:47 +03:00
|
|
|
QHash<QString, AddTorrentParams> m_downloadedTorrents;
|
2017-09-14 19:55:14 +03:00
|
|
|
QHash<InfoHash, RemovingTorrentData> m_removingTorrents;
|
2016-02-09 11:56:48 +03:00
|
|
|
QStringMap m_categories;
|
2017-06-05 03:22:17 +03:00
|
|
|
QSet<QString> m_tags;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2018-05-21 01:09:58 +03:00
|
|
|
// I/O errored torrents
|
|
|
|
QSet<InfoHash> m_recentErroredTorrents;
|
2019-10-01 10:33:11 +03:00
|
|
|
QTimer *m_recentErroredTorrentsTimer = nullptr;
|
2018-05-21 01:09:58 +03:00
|
|
|
|
2017-04-29 14:52:28 +03:00
|
|
|
SessionMetricIndices m_metricIndices;
|
2019-06-01 06:28:37 +03:00
|
|
|
lt::time_point m_statsLastTimestamp = lt::clock_type::now();
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2017-04-29 14:45:30 +03:00
|
|
|
SessionStatus m_status;
|
|
|
|
CacheStatus m_cacheStatus;
|
|
|
|
|
2019-10-01 10:33:11 +03:00
|
|
|
QNetworkConfigurationManager *m_networkManager = nullptr;
|
2015-06-15 01:06:56 +03:00
|
|
|
|
2020-02-14 08:18:15 +03:00
|
|
|
QList<MoveStorageJob> m_moveStorageQueue;
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
static Session *m_instance;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-04-23 16:40:36 +03:00
|
|
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
|
|
|
|
Q_DECLARE_METATYPE(std::shared_ptr<lt::entry>)
|
|
|
|
const int sharedPtrLtEntryTypeID = qRegisterMetaType<std::shared_ptr<lt::entry>>();
|
|
|
|
#endif
|