From 0bc2e9aeebe848993fe1ad78e2c90e4b02dadccc Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 18 Nov 2009 12:35:55 +0000 Subject: [PATCH] - Removed regular tracker scrape code since it is done automatically by libtorrent (it should not have been in GUI class anyway...) - Moved bittorrent specific code from GUI class to bittorrent class --- src/GUI.cpp | 19 ------------------- src/GUI.h | 2 -- src/bittorrent.cpp | 5 ++--- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index f890ca8f9..1227b36fa 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -234,9 +234,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis setWindowState(Qt::WindowMinimized); } - scrapeTimer = new QTimer(this); - connect(scrapeTimer, SIGNAL(timeout()), this, SLOT(scrapeTrackers())); - scrapeTimer->start(20000); qDebug("GUI Built"); } @@ -244,12 +241,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis GUI::~GUI() { qDebug("GUI destruction"); hide(); - // Do this as soon as possible - BTSession->saveDHTEntry(); - BTSession->saveSessionState(); - BTSession->saveFastResumeData(); - scrapeTimer->stop(); - delete scrapeTimer; delete dlSpeedLbl; delete upSpeedLbl; delete ratioLbl; @@ -310,16 +301,6 @@ void GUI::displayRSSTab(bool enable) { } } -void GUI::scrapeTrackers() { - std::vector torrents = BTSession->getTorrents(); - std::vector::iterator torrentIT; - for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { - QTorrentHandle h = QTorrentHandle(*torrentIT); - if(!h.is_valid()) continue; - h.scrape_tracker(); - } -} - void GUI::updateRatio() { // Update ratio info float ratio = 1.; diff --git a/src/GUI.h b/src/GUI.h index 4021e9794..0e5644578 100644 --- a/src/GUI.h +++ b/src/GUI.h @@ -67,7 +67,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{ // Bittorrent bittorrent *BTSession; QTimer *checkConnect; - QTimer *scrapeTimer; QList > unauthenticated_trackers; // GUI related QTabWidget *tabs; @@ -153,7 +152,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{ void finishedTorrent(QTorrentHandle& h) const; //void updateLists(bool force=false); bool initWebUi(QString username, QString password, int port); - void scrapeTrackers(); // Options slots void on_actionOptions_triggered(); void optionsSaved(); diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 29cd36f10..79f045767 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -104,10 +104,9 @@ bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause( bittorrent::~bittorrent() { qDebug("BTSession deletion"); // Do some BT related saving - // XXX: Done in GUI now (earlier = safer) - /*saveDHTEntry(); + saveDHTEntry(); saveSessionState(); - tResumeData();*/ + saveFastResumeData(); // Disable directory scanning disableDirectoryScanning(); // Delete our objects