-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSeedManager_p.hpp
68 lines (60 loc) · 1.84 KB
/
SeedManager_p.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef SEEDER_MANAGER_PRIVATE_HPP_INCLUDED
#define SEEDER_MANAGER_PRIVATE_HPP_INCLUDED
#include <QObject>
#include <QQueue>
#include <QSettings>
#include <QMap>
#include <QScopedPointer>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QTimer>
#include <libtorrent/session.hpp>
#include <libtorrent/settings_pack.hpp>
#include <libtorrent/add_torrent_params.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/torrent_status.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/error_code.hpp>
class SeedManagerPrivate : public QObject {
Q_OBJECT
public:
SeedManagerPrivate();
~SeedManagerPrivate();
public Q_SLOTS:
void updateProxy();
void startSeeding(QString, QString, QUrl);
void stopSeeding(QString);
private Q_SLOTS:
void getNextTorrentMeta();
void handleTorrentFileData(qint64, qint64);
void handleTorrentFileError(QNetworkReply::NetworkError);
void handleTorrentFileFinish();
void torrentLoop();
Q_SIGNALS:
void errorSeeding(QString);
void queuedSeeding(QString);
void startedSeeding(QString);
void removingSeeding(QString);
void stoppedSeeding(QString);
void torrentStatus(QString, QString);
private:
struct AppImageSeedInfo {
QString hash;
QString path;
QUrl torrentFileUrl;
bool empty = true;
};
QTimer m_Timer;
AppImageSeedInfo m_CurrentTorrent;
QQueue<AppImageSeedInfo> m_QueuedTorrents;
QList<QString> m_ReqTorrentForRemoval;
QMap<QString, lt::torrent_handle> m_Torrents;
QScopedPointer<QNetworkAccessManager> m_Manager;
QScopedPointer<QByteArray> m_TorrentMeta;
QScopedPointer<lt::session> m_Session;
};
#endif // SEED_MANAGER_PRIVATE_HPP_INCLUDED