From 9618056b4e029f9bb6334278d955767ae2cce256 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 2 Nov 2008 19:22:10 +0000 Subject: [PATCH] - Added support for 2 new extensions (uTorrent metadata and smart ban plugin) - Removed option to disable uTorrent Peer eXchange (PeX) -> always ON --- Changelog | 1 + src/GUI.cpp | 8 +------- src/bittorrent.cpp | 16 +++++++--------- src/bittorrent.h | 1 - src/options.ui | 11 ----------- src/options_imp.cpp | 7 ------- 6 files changed, 9 insertions(+), 35 deletions(-) diff --git a/Changelog b/Changelog index 7ba618f98..7e284a9e6 100644 --- a/Changelog +++ b/Changelog @@ -7,6 +7,7 @@ - FEATURE: Code cleanup and optimization (save memory and cpu) - FEATURE: ETA calculation now relies on average speed over all sessions - FEATURE: Allow to force rechecking torrents + - FEATURE: Added support for 2 new extensions (uTorrent metadata and smart ban plugin) * Unknown - Christophe Dumez - v1.2.1 - BUGFIX: Fixed possible crash when deleting a torrent permanently diff --git a/src/GUI.cpp b/src/GUI.cpp index 39b074dea..ecf49f07d 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -1082,13 +1082,7 @@ void GUI::configureSession(bool deleteOptions) { BTSession->addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("blue")); } // * PeX - if(options->isPeXEnabled()) { - BTSession->addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue")); - BTSession->enablePeerExchange(); - }else{ - // TODO: How can we remove the extension? - BTSession->addConsoleMessage(tr("PeX support [OFF]"), QString::fromUtf8("blue")); - } + BTSession->addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue")); // * LSD if(options->isLSDEnabled()) { BTSession->enableLSD(true); diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index f7a34c4d4..6af6b1df7 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -29,9 +29,10 @@ #include "misc.h" #include "downloadThread.h" #include "filterParserThread.h" - -#include +#include #include +#include +#include #include #include #include @@ -58,8 +59,11 @@ bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false s->set_alert_mask(alert::error_notification | alert::peer_notification | alert::port_mapping_notification | alert::storage_notification | alert::tracker_notification | alert::status_notification | alert::ip_block_notification); // Load previous state loadSessionState(); - // Enabling metadata plugin + // Enabling plugins s->add_extension(&create_metadata_plugin); + s->add_extension(&create_ut_metadata_plugin); + s->add_extension(&create_ut_pex_plugin); + s->add_extension(&create_smart_ban_plugin); timerAlerts = new QTimer(); connect(timerAlerts, SIGNAL(timeout()), this, SLOT(readAlerts())); timerAlerts->start(3000); @@ -1134,12 +1138,6 @@ void bittorrent::saveTrackerFile(QString hash) { tracker_file.close(); } -// Add uT PeX extension to bittorrent session -void bittorrent::enablePeerExchange() { - qDebug("Enabling Peer eXchange"); - s->add_extension(&create_ut_pex_plugin); -} - // Set DHT port (>= 1000) void bittorrent::setDHTPort(int dht_port) { if(dht_port >= 1000) { diff --git a/src/bittorrent.h b/src/bittorrent.h index cb3e1b45d..9cd3505db 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -128,7 +128,6 @@ class bittorrent : public QObject { void saveFastResumeData(QString hash); void enableDirectoryScanning(QString scan_dir); void disableDirectoryScanning(); - void enablePeerExchange(); void enableIPFilter(QString filter); void disableIPFilter(); void setQueueingEnabled(bool enable); diff --git a/src/options.ui b/src/options.ui index 7c0a646e1..1fe73979d 100644 --- a/src/options.ui +++ b/src/options.ui @@ -1068,16 +1068,6 @@ - - - - Enable Peer eXchange (PeX) - - - true - - - @@ -2339,7 +2329,6 @@ checkMaxUploadsPerTorrent spinMaxUploadsPerTorrent checkDHT - checkPeX checkLSD comboEncryption checkRatioLimit diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 1520130e7..d6a6e176d 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -192,7 +192,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(spinMaxConnecPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(checkDHT, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); - connect(checkPeX, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(checkLSD, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(checkAzureusSpoof, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton())); connect(comboEncryption, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); @@ -357,7 +356,6 @@ void options_imp::saveOptions(){ settings.setValue(QString::fromUtf8("MaxConnecsPerTorrent"), getMaxConnecsPerTorrent()); settings.setValue(QString::fromUtf8("MaxUploadsPerTorrent"), getMaxUploadsPerTorrent()); settings.setValue(QString::fromUtf8("DHT"), isDHTEnabled()); - settings.setValue(QString::fromUtf8("PeX"), isPeXEnabled()); settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled()); settings.setValue(QString::fromUtf8("AzureusSpoof"), shouldSpoofAzureus()); settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting()); @@ -646,7 +644,6 @@ void options_imp::loadOptions(){ spinMaxUploadsPerTorrent->setEnabled(false); } checkDHT->setChecked(settings.value(QString::fromUtf8("DHT"), true).toBool()); - checkPeX->setChecked(settings.value(QString::fromUtf8("PeX"), true).toBool()); checkLSD->setChecked(settings.value(QString::fromUtf8("LSD"), true).toBool()); checkAzureusSpoof->setChecked(settings.value(QString::fromUtf8("AzureusSpoof"), false).toBool()); comboEncryption->setCurrentIndex(settings.value(QString::fromUtf8("Encryption"), 0).toInt()); @@ -778,10 +775,6 @@ bool options_imp::isRSSEnabled() const{ return checkEnableRSS->isChecked(); } -bool options_imp::isPeXEnabled() const{ - return checkPeX->isChecked(); -} - bool options_imp::isLSDEnabled() const{ return checkLSD->isChecked(); }