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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BITTORRENT_SESSION_H
|
|
|
|
#define BITTORRENT_SESSION_H
|
|
|
|
|
2016-05-01 11:05:52 +03:00
|
|
|
#include <vector>
|
|
|
|
#include <libtorrent/version.hpp>
|
|
|
|
|
2017-04-29 14:52:28 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM >= 10100
|
|
|
|
#include <QElapsedTimer>
|
|
|
|
#endif
|
2015-04-19 18:17:47 +03:00
|
|
|
#include <QFile>
|
|
|
|
#include <QHash>
|
2016-02-09 11:56:48 +03:00
|
|
|
#include <QMap>
|
2016-05-01 11:05:52 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM < 10100
|
|
|
|
#include <QMutex>
|
|
|
|
#endif
|
|
|
|
#include <QNetworkConfigurationManager>
|
2015-04-19 18:17:47 +03:00
|
|
|
#include <QPointer>
|
2017-06-05 03:22:17 +03:00
|
|
|
#include <QSet>
|
2016-05-01 11:05:52 +03:00
|
|
|
#include <QStringList>
|
2015-04-19 18:17:47 +03:00
|
|
|
#include <QVector>
|
|
|
|
#include <QWaitCondition>
|
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/tristatebool.h"
|
|
|
|
#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"
|
|
|
|
|
|
|
|
namespace libtorrent
|
|
|
|
{
|
|
|
|
class session;
|
2016-01-20 09:57:02 +03:00
|
|
|
struct torrent_handle;
|
2015-09-25 10:52:25 +03:00
|
|
|
class entry;
|
2017-03-07 02:34:55 +03:00
|
|
|
struct ip_filter;
|
2016-06-03 17:03:17 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM < 10100
|
2015-04-19 18:17:47 +03:00
|
|
|
struct session_settings;
|
2016-06-03 17:03:17 +03:00
|
|
|
#else
|
|
|
|
struct settings_pack;
|
|
|
|
#endif
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
class alert;
|
|
|
|
struct torrent_alert;
|
|
|
|
struct state_update_alert;
|
|
|
|
struct stats_alert;
|
|
|
|
struct add_torrent_alert;
|
|
|
|
struct torrent_checked_alert;
|
|
|
|
struct torrent_finished_alert;
|
|
|
|
struct torrent_removed_alert;
|
|
|
|
struct torrent_deleted_alert;
|
2015-08-09 10:27:56 +03:00
|
|
|
struct torrent_delete_failed_alert;
|
2015-04-19 18:17:47 +03:00
|
|
|
struct torrent_paused_alert;
|
|
|
|
struct torrent_resumed_alert;
|
|
|
|
struct save_resume_data_alert;
|
|
|
|
struct save_resume_data_failed_alert;
|
|
|
|
struct file_renamed_alert;
|
|
|
|
struct storage_moved_alert;
|
|
|
|
struct storage_moved_failed_alert;
|
|
|
|
struct metadata_received_alert;
|
|
|
|
struct file_error_alert;
|
|
|
|
struct file_completed_alert;
|
|
|
|
struct tracker_error_alert;
|
|
|
|
struct tracker_reply_alert;
|
|
|
|
struct tracker_warning_alert;
|
|
|
|
struct portmap_error_alert;
|
|
|
|
struct portmap_alert;
|
|
|
|
struct peer_blocked_alert;
|
|
|
|
struct peer_ban_alert;
|
|
|
|
struct fastresume_rejected_alert;
|
|
|
|
struct url_seed_alert;
|
|
|
|
struct listen_succeeded_alert;
|
|
|
|
struct listen_failed_alert;
|
|
|
|
struct external_ip_alert;
|
2017-04-29 14:52:28 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM >= 10100
|
|
|
|
struct session_stats_alert;
|
|
|
|
#endif
|
2015-04-19 18:17:47 +03:00
|
|
|
}
|
|
|
|
|
2015-12-13 15:38:19 +03:00
|
|
|
class QThread;
|
2015-04-19 18:17:47 +03:00
|
|
|
class QTimer;
|
|
|
|
class QStringList;
|
2015-09-25 10:52:25 +03:00
|
|
|
class QString;
|
|
|
|
class QUrl;
|
|
|
|
template<typename T> class QList;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
class FilterParserThread;
|
|
|
|
class BandwidthScheduler;
|
|
|
|
class Statistics;
|
2015-12-13 15:38:19 +03:00
|
|
|
class ResumeDataSavingManager;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2016-02-09 11:56:48 +03:00
|
|
|
enum MaxRatioAction
|
|
|
|
{
|
|
|
|
Pause,
|
|
|
|
Remove
|
|
|
|
};
|
|
|
|
|
|
|
|
enum TorrentExportFolder
|
|
|
|
{
|
|
|
|
Regular,
|
|
|
|
Finished
|
|
|
|
};
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
namespace BitTorrent
|
|
|
|
{
|
|
|
|
class InfoHash;
|
|
|
|
class TorrentHandle;
|
|
|
|
class Tracker;
|
|
|
|
class MagnetUri;
|
|
|
|
class TrackerEntry;
|
|
|
|
struct AddTorrentData;
|
|
|
|
|
|
|
|
struct TorrentStatusReport
|
|
|
|
{
|
2015-11-05 19:17:10 +03:00
|
|
|
uint nbDownloading = 0;
|
|
|
|
uint nbSeeding = 0;
|
|
|
|
uint nbCompleted = 0;
|
|
|
|
uint nbActive = 0;
|
|
|
|
uint nbInactive = 0;
|
|
|
|
uint nbPaused = 0;
|
|
|
|
uint nbResumed = 0;
|
2015-11-11 09:51:22 +03:00
|
|
|
uint nbErrored = 0;
|
2015-04-19 18:17:47 +03:00
|
|
|
};
|
|
|
|
|
2017-04-29 14:52:28 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM >= 10100
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
QStringList categories() const;
|
|
|
|
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);
|
2017-04-15 17:21:24 +03:00
|
|
|
bool isCreateTorrentSubfolder() const;
|
|
|
|
void setCreateTorrentSubfolder(bool value);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isTrackerEnabled() const;
|
|
|
|
void setTrackerEnabled(bool enabled);
|
|
|
|
bool isAppendExtensionEnabled() const;
|
|
|
|
void setAppendExtensionEnabled(bool enabled);
|
|
|
|
uint refreshInterval() const;
|
|
|
|
void setRefreshInterval(uint value);
|
|
|
|
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);
|
|
|
|
|
|
|
|
uint saveResumeDataInterval() const;
|
|
|
|
void setSaveResumeDataInterval(uint value);
|
|
|
|
int port() const;
|
|
|
|
void setPort(int port);
|
|
|
|
bool useRandomPort() const;
|
|
|
|
void setUseRandomPort(bool value);
|
|
|
|
QString networkInterface() const;
|
|
|
|
void setNetworkInterface(const QString &interface);
|
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);
|
|
|
|
bool isIPv6Enabled() const;
|
|
|
|
void setIPv6Enabled(bool enabled);
|
|
|
|
int encryption() const;
|
|
|
|
void setEncryption(int state);
|
|
|
|
bool isForceProxyEnabled() const;
|
|
|
|
void setForceProxyEnabled(bool enabled);
|
|
|
|
bool isProxyPeerConnectionsEnabled() const;
|
|
|
|
void setProxyPeerConnectionsEnabled(bool enabled);
|
2017-08-11 12:06:31 +03:00
|
|
|
int chokingAlgorithm() const;
|
|
|
|
void setChokingAlgorithm(int mode);
|
|
|
|
int seedChokingAlgorithm() const;
|
|
|
|
void setSeedChokingAlgorithm(int 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-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);
|
2017-08-11 10:50:56 +03:00
|
|
|
bool isGuidedReadCacheEnabled() const;
|
|
|
|
void setGuidedReadCacheEnabled(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);
|
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);
|
2017-08-18 20:20:53 +03:00
|
|
|
int outgoingPortsMin() const;
|
|
|
|
void setOutgoingPortsMin(int min);
|
|
|
|
int outgoingPortsMax() const;
|
|
|
|
void setOutgoingPortsMax(int max);
|
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);
|
2016-05-01 11:05:52 +03:00
|
|
|
bool isSuperSeedingEnabled() const;
|
|
|
|
void setSuperSeedingEnabled(bool enabled);
|
|
|
|
int maxConnections() const;
|
|
|
|
void setMaxConnections(int max);
|
|
|
|
int maxHalfOpenConnections() const;
|
|
|
|
void setMaxHalfOpenConnections(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);
|
|
|
|
bool isUTPEnabled() const;
|
|
|
|
void setUTPEnabled(bool enabled);
|
|
|
|
bool isUTPRateLimited() const;
|
|
|
|
void setUTPRateLimited(bool limited);
|
2017-08-11 11:28:52 +03:00
|
|
|
int utpMixedMode() const;
|
|
|
|
void setUtpMixedMode(int mode);
|
2017-08-11 11:37:32 +03:00
|
|
|
bool multiConnectionsPerIpEnabled() const;
|
|
|
|
void setMultiConnectionsPerIpEnabled(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);
|
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;
|
|
|
|
QHash<InfoHash, TorrentHandle *> torrents() const;
|
2015-11-05 19:17:10 +03:00
|
|
|
TorrentStatusReport torrentStatusReport() const;
|
2015-04-19 18:17:47 +03:00
|
|
|
bool hasActiveTorrents() const;
|
|
|
|
bool hasUnfinishedTorrents() 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;
|
|
|
|
bool addTorrent(QString source, const AddTorrentParams ¶ms = AddTorrentParams());
|
|
|
|
bool addTorrent(const TorrentInfo &torrentInfo, const AddTorrentParams ¶ms = AddTorrentParams());
|
|
|
|
bool deleteTorrent(const QString &hash, bool deleteLocalFiles = false);
|
2016-01-07 14:22:35 +03:00
|
|
|
bool loadMetadata(const MagnetUri &magnetUri);
|
2015-04-19 18:17:47 +03:00
|
|
|
bool cancelLoadMetadata(const InfoHash &hash);
|
|
|
|
|
|
|
|
void recursiveTorrentDownload(const InfoHash &hash);
|
|
|
|
void increaseTorrentsPriority(const QStringList &hashes);
|
|
|
|
void decreaseTorrentsPriority(const QStringList &hashes);
|
|
|
|
void topTorrentsPriority(const QStringList &hashes);
|
|
|
|
void bottomTorrentsPriority(const QStringList &hashes);
|
|
|
|
|
2015-09-25 10:52:25 +03:00
|
|
|
// TorrentHandle interface
|
2016-02-07 20:31:50 +03:00
|
|
|
void handleTorrentShareLimitChanged(TorrentHandle *const torrent);
|
2015-09-25 10:52:25 +03:00
|
|
|
void handleTorrentSavePathChanged(TorrentHandle *const torrent);
|
2016-02-09 11:56:48 +03:00
|
|
|
void handleTorrentCategoryChanged(TorrentHandle *const torrent, const QString &oldCategory);
|
2017-06-05 03:22:17 +03:00
|
|
|
void handleTorrentTagAdded(TorrentHandle *const torrent, const QString &tag);
|
|
|
|
void handleTorrentTagRemoved(TorrentHandle *const torrent, const QString &tag);
|
2016-02-09 11:56:48 +03:00
|
|
|
void handleTorrentSavingModeChanged(TorrentHandle *const torrent);
|
2015-09-25 10:52:25 +03:00
|
|
|
void handleTorrentMetadataReceived(TorrentHandle *const torrent);
|
|
|
|
void handleTorrentPaused(TorrentHandle *const torrent);
|
|
|
|
void handleTorrentResumed(TorrentHandle *const torrent);
|
|
|
|
void handleTorrentChecked(TorrentHandle *const torrent);
|
|
|
|
void handleTorrentFinished(TorrentHandle *const torrent);
|
|
|
|
void handleTorrentTrackersAdded(TorrentHandle *const torrent, const QList<TrackerEntry> &newTrackers);
|
|
|
|
void handleTorrentTrackersRemoved(TorrentHandle *const torrent, const QList<TrackerEntry> &deletedTrackers);
|
|
|
|
void handleTorrentTrackersChanged(TorrentHandle *const torrent);
|
|
|
|
void handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QList<QUrl> &newUrlSeeds);
|
|
|
|
void handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QList<QUrl> &urlSeeds);
|
|
|
|
void handleTorrentResumeDataReady(TorrentHandle *const torrent, const libtorrent::entry &data);
|
|
|
|
void handleTorrentResumeDataFailed(TorrentHandle *const torrent);
|
|
|
|
void handleTorrentTrackerReply(TorrentHandle *const torrent, const QString &trackerUrl);
|
|
|
|
void handleTorrentTrackerWarning(TorrentHandle *const torrent, const QString &trackerUrl);
|
|
|
|
void handleTorrentTrackerError(TorrentHandle *const torrent, const QString &trackerUrl);
|
|
|
|
void handleTorrentTrackerAuthenticationRequired(TorrentHandle *const torrent, const QString &trackerUrl);
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
signals:
|
2017-04-29 14:45:30 +03:00
|
|
|
void statsUpdated();
|
2015-11-05 19:17:10 +03:00
|
|
|
void torrentsUpdated();
|
2015-04-19 18:17:47 +03:00
|
|
|
void addTorrentFailed(const QString &error);
|
|
|
|
void torrentAdded(BitTorrent::TorrentHandle *const torrent);
|
2016-04-30 01:38:24 +03:00
|
|
|
void torrentNew(BitTorrent::TorrentHandle *const torrent);
|
2015-04-19 18:17:47 +03:00
|
|
|
void torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void torrentPaused(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void torrentResumed(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void torrentFinished(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void torrentFinishedChecking(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void torrentSavePathChanged(BitTorrent::TorrentHandle *const torrent);
|
2016-02-09 11:56:48 +03:00
|
|
|
void torrentCategoryChanged(BitTorrent::TorrentHandle *const torrent, const QString &oldCategory);
|
2017-06-05 03:22:17 +03:00
|
|
|
void torrentTagAdded(TorrentHandle *const torrent, const QString &tag);
|
|
|
|
void torrentTagRemoved(TorrentHandle *const torrent, const QString &tag);
|
2016-02-09 11:56:48 +03:00
|
|
|
void torrentSavingModeChanged(BitTorrent::TorrentHandle *const torrent);
|
2015-04-19 18:17:47 +03:00
|
|
|
void allTorrentsFinished();
|
|
|
|
void metadataLoaded(const BitTorrent::TorrentInfo &info);
|
|
|
|
void torrentMetadataLoaded(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg);
|
|
|
|
void trackerSuccess(BitTorrent::TorrentHandle *const torrent, const QString &tracker);
|
|
|
|
void trackerWarning(BitTorrent::TorrentHandle *const torrent, const QString &tracker);
|
|
|
|
void trackerError(BitTorrent::TorrentHandle *const torrent, const QString &tracker);
|
|
|
|
void trackerAuthenticationRequired(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void recursiveTorrentDownloadPossible(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void speedLimitModeChanged(bool alternative);
|
2016-05-01 11:05:52 +03:00
|
|
|
void IPFilterParsed(bool error, int ruleCount);
|
2015-04-19 18:17:47 +03:00
|
|
|
void trackersAdded(BitTorrent::TorrentHandle *const torrent, const QList<BitTorrent::TrackerEntry> &trackers);
|
|
|
|
void trackersRemoved(BitTorrent::TorrentHandle *const torrent, const QList<BitTorrent::TrackerEntry> &trackers);
|
|
|
|
void trackersChanged(BitTorrent::TorrentHandle *const torrent);
|
|
|
|
void trackerlessStateChanged(BitTorrent::TorrentHandle *const torrent, bool trackerless);
|
|
|
|
void downloadFromUrlFailed(const QString &url, const QString &reason);
|
|
|
|
void downloadFromUrlFinished(const QString &url);
|
2016-02-09 11:56:48 +03:00
|
|
|
void categoryAdded(const QString &categoryName);
|
|
|
|
void categoryRemoved(const QString &categoryName);
|
|
|
|
void subcategoriesSupportChanged();
|
2017-06-05 03:22:17 +03:00
|
|
|
void tagAdded(const QString &tag);
|
|
|
|
void tagRemoved(const QString &tag);
|
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();
|
|
|
|
void refresh();
|
2016-02-07 20:31:50 +03:00
|
|
|
void processShareLimits();
|
2015-04-19 18:17:47 +03:00
|
|
|
void generateResumeData(bool final = false);
|
|
|
|
void handleIPFilterParsed(int ruleCount);
|
|
|
|
void handleIPFilterError();
|
|
|
|
void handleDownloadFinished(const QString &url, const QString &filePath);
|
|
|
|
void handleDownloadFailed(const QString &url, const QString &reason);
|
|
|
|
void handleRedirectedToMagnet(const QString &url, const QString &magnetUri);
|
2015-07-22 08:51:23 +03:00
|
|
|
void switchToAlternativeMode(bool alternative);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2015-06-15 01:06:56 +03:00
|
|
|
// Session reconfiguration triggers
|
|
|
|
void networkOnlineStateChanged(const bool online);
|
|
|
|
void networkConfigurationChange(const QNetworkConfiguration&);
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
private:
|
|
|
|
explicit Session(QObject *parent = 0);
|
|
|
|
~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();
|
2016-06-03 17:03:17 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM < 10100
|
|
|
|
void configure(libtorrent::session_settings &sessionSettings);
|
2015-04-19 18:17:47 +03:00
|
|
|
void adjustLimits(libtorrent::session_settings &sessionSettings);
|
2016-06-03 17:03:17 +03:00
|
|
|
#else
|
|
|
|
void configure(libtorrent::settings_pack &settingsPack);
|
2017-05-01 19:19:34 +03:00
|
|
|
void configurePeerClasses();
|
2016-06-03 17:03:17 +03:00
|
|
|
void adjustLimits(libtorrent::settings_pack &settingsPack);
|
2017-04-29 14:52:28 +03:00
|
|
|
void initMetrics();
|
2016-06-03 17:03:17 +03:00
|
|
|
#endif
|
|
|
|
void adjustLimits();
|
2017-03-07 02:34:55 +03:00
|
|
|
void processBannedIPs(libtorrent::ip_filter &filter);
|
2015-11-07 03:06:07 +03:00
|
|
|
const QStringList getListeningIPs();
|
2016-05-01 11:05:52 +03:00
|
|
|
void configureListeningInterface();
|
2015-07-22 08:51:23 +03:00
|
|
|
void changeSpeedLimitMode_impl(bool alternative);
|
2016-05-01 11:05:52 +03:00
|
|
|
void enableTracker(bool enable);
|
|
|
|
void enableBandwidthScheduler();
|
|
|
|
void populateAdditionalTrackers();
|
2016-06-03 17:03:17 +03:00
|
|
|
void enableIPFilter();
|
|
|
|
void disableIPFilter();
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2015-11-01 09:22:18 +03:00
|
|
|
bool addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri,
|
2016-04-19 09:54:48 +03:00
|
|
|
TorrentInfo torrentInfo = TorrentInfo(),
|
2015-04-19 18:17:47 +03:00
|
|
|
const QByteArray &fastresumeData = QByteArray());
|
2016-04-19 09:54:48 +03:00
|
|
|
bool findIncompleteFiles(TorrentInfo &torrentInfo, QString &savePath) const;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2016-02-07 20:31:50 +03:00
|
|
|
void updateSeedingLimitTimer();
|
2015-04-19 18:17:47 +03:00
|
|
|
void exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolder folder = TorrentExportFolder::Regular);
|
2017-01-18 19:23:57 +03:00
|
|
|
void saveTorrentResumeData(TorrentHandle *const torrent, bool finalSave = false);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
void handleAlert(libtorrent::alert *a);
|
|
|
|
void dispatchTorrentAlert(libtorrent::alert *a);
|
|
|
|
void handleAddTorrentAlert(libtorrent::add_torrent_alert *p);
|
|
|
|
void handleStateUpdateAlert(libtorrent::state_update_alert *p);
|
|
|
|
void handleMetadataReceivedAlert(libtorrent::metadata_received_alert *p);
|
|
|
|
void handleFileErrorAlert(libtorrent::file_error_alert *p);
|
|
|
|
void handleTorrentRemovedAlert(libtorrent::torrent_removed_alert *p);
|
|
|
|
void handleTorrentDeletedAlert(libtorrent::torrent_deleted_alert *p);
|
2015-08-09 10:27:56 +03:00
|
|
|
void handleTorrentDeleteFailedAlert(libtorrent::torrent_delete_failed_alert *p);
|
2015-04-19 18:17:47 +03:00
|
|
|
void handlePortmapWarningAlert(libtorrent::portmap_error_alert *p);
|
|
|
|
void handlePortmapAlert(libtorrent::portmap_alert *p);
|
|
|
|
void handlePeerBlockedAlert(libtorrent::peer_blocked_alert *p);
|
|
|
|
void handlePeerBanAlert(libtorrent::peer_ban_alert *p);
|
|
|
|
void handleUrlSeedAlert(libtorrent::url_seed_alert *p);
|
|
|
|
void handleListenSucceededAlert(libtorrent::listen_succeeded_alert *p);
|
|
|
|
void handleListenFailedAlert(libtorrent::listen_failed_alert *p);
|
|
|
|
void handleExternalIPAlert(libtorrent::external_ip_alert *p);
|
2017-04-29 14:52:28 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM >= 10100
|
|
|
|
void handleSessionStatsAlert(libtorrent::session_stats_alert *p);
|
|
|
|
#endif
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2016-01-20 09:57:02 +03:00
|
|
|
void createTorrentHandle(const libtorrent::torrent_handle &nativeHandle);
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
void saveResumeData();
|
|
|
|
|
2016-04-28 10:56:58 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM < 10100
|
2016-12-08 15:13:14 +03:00
|
|
|
void dispatchAlerts(libtorrent::alert *alertPtr);
|
2017-04-29 14:52:28 +03:00
|
|
|
void updateStats();
|
2016-04-28 10:56:58 +03:00
|
|
|
#endif
|
|
|
|
void getPendingAlerts(std::vector<libtorrent::alert *> &out, ulong time = 0);
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
// BitTorrent
|
|
|
|
libtorrent::session *m_nativeSession;
|
|
|
|
|
2016-05-01 11:05:52 +03:00
|
|
|
bool m_deferredConfigureScheduled;
|
2016-06-03 17:03:17 +03:00
|
|
|
bool m_IPFilteringChanged;
|
|
|
|
#if LIBTORRENT_VERSION_NUM >= 10100
|
|
|
|
bool m_listenInterfaceChanged; // optimization
|
|
|
|
#endif
|
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-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;
|
2017-08-11 10:50:56 +03:00
|
|
|
CachedSettingValue<bool> m_guidedReadCacheEnabled;
|
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;
|
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;
|
2017-08-18 20:20:53 +03:00
|
|
|
CachedSettingValue<int> m_outgoingPortsMin;
|
|
|
|
CachedSettingValue<int> m_outgoingPortsMax;
|
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;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isSuperSeedingEnabled;
|
|
|
|
CachedSettingValue<int> m_maxConnections;
|
|
|
|
CachedSettingValue<int> m_maxHalfOpenConnections;
|
|
|
|
CachedSettingValue<int> m_maxUploads;
|
|
|
|
CachedSettingValue<int> m_maxConnectionsPerTorrent;
|
|
|
|
CachedSettingValue<int> m_maxUploadsPerTorrent;
|
|
|
|
CachedSettingValue<bool> m_isUTPEnabled;
|
|
|
|
CachedSettingValue<bool> m_isUTPRateLimited;
|
2017-08-11 11:28:52 +03:00
|
|
|
CachedSettingValue<int> m_utpMixedMode;
|
2017-08-11 11:37:32 +03:00
|
|
|
CachedSettingValue<bool> m_multiConnectionsPerIpEnabled;
|
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;
|
2017-04-15 17:21:24 +03:00
|
|
|
CachedSettingValue<bool> m_isCreateTorrentSubfolder;
|
2016-05-01 11:05:52 +03:00
|
|
|
CachedSettingValue<bool> m_isAppendExtensionEnabled;
|
|
|
|
CachedSettingValue<uint> m_refreshInterval;
|
|
|
|
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;
|
|
|
|
CachedSettingValue<uint> m_saveResumeDataInterval;
|
|
|
|
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<bool> m_isIPv6Enabled;
|
|
|
|
CachedSettingValue<int> m_encryption;
|
|
|
|
CachedSettingValue<bool> m_isForceProxyEnabled;
|
|
|
|
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
|
2017-08-11 12:06:31 +03:00
|
|
|
CachedSettingValue<int> m_chokingAlgorithm;
|
|
|
|
CachedSettingValue<int> 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;
|
|
|
|
CachedSettingValue<QStringList> m_bannedIPs;
|
|
|
|
|
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.
|
|
|
|
const bool m_wasPexEnabled;
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
int m_numResumeData;
|
|
|
|
int m_extraLimit;
|
2016-05-01 11:05:52 +03:00
|
|
|
QList<BitTorrent::TrackerEntry> m_additionalTrackerList;
|
2015-04-19 18:17:47 +03:00
|
|
|
QString m_resumeFolderPath;
|
|
|
|
QFile m_resumeFolderLock;
|
|
|
|
QHash<InfoHash, QString> m_savePathsToRemove;
|
2016-05-01 11:05:52 +03:00
|
|
|
bool m_useProxy;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
QTimer *m_refreshTimer;
|
2016-02-07 20:31:50 +03:00
|
|
|
QTimer *m_seedingLimitTimer;
|
2015-04-19 18:17:47 +03:00
|
|
|
QTimer *m_resumeDataTimer;
|
|
|
|
Statistics *m_statistics;
|
|
|
|
// 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
|
|
|
|
QThread *m_ioThread;
|
|
|
|
ResumeDataSavingManager *m_resumeDataSavingManager;
|
2015-04-19 18:17:47 +03:00
|
|
|
|
|
|
|
QHash<InfoHash, TorrentInfo> m_loadedMetadata;
|
|
|
|
QHash<InfoHash, TorrentHandle *> m_torrents;
|
|
|
|
QHash<InfoHash, AddTorrentData> m_addingTorrents;
|
|
|
|
QHash<QString, AddTorrentParams> m_downloadedTorrents;
|
2015-11-05 19:17:10 +03:00
|
|
|
TorrentStatusReport m_torrentStatusReport;
|
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
|
|
|
|
2016-04-28 10:56:58 +03:00
|
|
|
#if LIBTORRENT_VERSION_NUM < 10100
|
2015-04-19 18:17:47 +03:00
|
|
|
QMutex m_alertsMutex;
|
|
|
|
QWaitCondition m_alertsWaitCondition;
|
2016-04-28 10:56:58 +03:00
|
|
|
std::vector<libtorrent::alert *> m_alerts;
|
2017-04-29 14:52:28 +03:00
|
|
|
#else
|
|
|
|
SessionMetricIndices m_metricIndices;
|
|
|
|
QElapsedTimer m_statsUpdateTimer;
|
2016-04-28 10:56:58 +03:00
|
|
|
#endif
|
2015-04-19 18:17:47 +03:00
|
|
|
|
2017-04-29 14:45:30 +03:00
|
|
|
SessionStatus m_status;
|
|
|
|
CacheStatus m_cacheStatus;
|
|
|
|
|
2015-06-15 01:06:56 +03:00
|
|
|
QNetworkConfigurationManager m_networkManager;
|
|
|
|
|
2015-04-19 18:17:47 +03:00
|
|
|
static Session *m_instance;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // BITTORRENT_SESSION_H
|