Browse Source

- Added support for 2 new extensions (uTorrent metadata and smart ban plugin)

- Removed option to disable uTorrent Peer eXchange (PeX) -> always ON
adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
9618056b4e
  1. 1
      Changelog
  2. 6
      src/GUI.cpp
  3. 16
      src/bittorrent.cpp
  4. 1
      src/bittorrent.h
  5. 11
      src/options.ui
  6. 7
      src/options_imp.cpp

1
Changelog

@ -7,6 +7,7 @@ @@ -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 <chris@qbittorrent.org> - v1.2.1
- BUGFIX: Fixed possible crash when deleting a torrent permanently

6
src/GUI.cpp

@ -1082,13 +1082,7 @@ void GUI::configureSession(bool deleteOptions) { @@ -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"));
}
// * LSD
if(options->isLSDEnabled()) {
BTSession->enableLSD(true);

16
src/bittorrent.cpp

@ -29,9 +29,10 @@ @@ -29,9 +29,10 @@
#include "misc.h"
#include "downloadThread.h"
#include "filterParserThread.h"
#include <libtorrent/extensions/metadata_transfer.hpp>
#include <libtorrent/extensions/ut_metadata.hpp>
#include <libtorrent/extensions/ut_pex.hpp>
#include <libtorrent/extensions/smart_ban.hpp>
#include <libtorrent/extensions/metadata_transfer.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/identify_client.hpp>
@ -58,8 +59,11 @@ bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false @@ -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) { @@ -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) {

1
src/bittorrent.h

@ -128,7 +128,6 @@ class bittorrent : public QObject { @@ -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);

11
src/options.ui

@ -1068,16 +1068,6 @@ @@ -1068,16 +1068,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkPeX" >
<property name="text" >
<string>Enable Peer eXchange (PeX)</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkLSD" >
<property name="text" >
@ -2339,7 +2329,6 @@ @@ -2339,7 +2329,6 @@
<tabstop>checkMaxUploadsPerTorrent</tabstop>
<tabstop>spinMaxUploadsPerTorrent</tabstop>
<tabstop>checkDHT</tabstop>
<tabstop>checkPeX</tabstop>
<tabstop>checkLSD</tabstop>
<tabstop>comboEncryption</tabstop>
<tabstop>checkRatioLimit</tabstop>

7
src/options_imp.cpp

@ -192,7 +192,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -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(){ @@ -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(){ @@ -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{ @@ -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();
}

Loading…
Cancel
Save