Browse Source

Maximum number of half-open connections can now be changed from program preferences (default is now 50 instead of unlimited)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
63457c034f
  1. 3
      Changelog
  2. 2
      src/Icons/qBittorrent.desktop
  3. BIN
      src/Icons/skin/splash.png
  4. 16
      src/advancedsettings.h
  5. 2
      src/bittorrent.cpp
  6. 13
      src/preferences.h

3
Changelog

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.3.0
- FEATURE: Max number of half-open connections can now be edited
* Sun Mar 14 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.0
- FEATURE: User can set alternative speed limits for fast toggling
- FEATURE: Bandwidth scheduler (automatically use alternative speed limits for a given period)

2
src/Icons/qBittorrent.desktop

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[Desktop Entry]
Categories=Qt;Network;P2P;
Comment=V2.2.0
Comment=V2.3.0
Exec=qbittorrent %f
GenericName=Bittorrent client
GenericName[bg]=Торент клиент

BIN
src/Icons/skin/splash.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 79 KiB

16
src/advancedsettings.h

@ -8,14 +8,14 @@ @@ -8,14 +8,14 @@
#include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE};
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS };
#define ROW_COUNT 9
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN };
#define ROW_COUNT 10
class AdvancedSettings: public QTableWidget {
Q_OBJECT
private:
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh;
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh, *spin_maxhalfopen;
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts;
public:
@ -45,6 +45,7 @@ public: @@ -45,6 +45,7 @@ public:
delete spin_list_refresh;
delete cb_resolve_countries;
delete cb_resolve_hosts;
delete spin_maxhalfopen;
}
public slots:
@ -65,6 +66,8 @@ public slots: @@ -65,6 +66,8 @@ public slots:
// Peer resolution
Preferences::resolvePeerCountries(cb_resolve_countries->isChecked());
Preferences::resolvePeerHostNames(cb_resolve_hosts->isChecked());
// Max Half-Open connections
Preferences::setMaxHalfOpenConnections(spin_maxhalfopen->value());
}
protected slots:
@ -133,6 +136,13 @@ protected slots: @@ -133,6 +136,13 @@ protected slots:
connect(cb_resolve_hosts, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
cb_resolve_hosts->setChecked(Preferences::resolvePeerHostNames());
setCellWidget(RESOLVE_HOSTS, VALUE, cb_resolve_hosts);
// Max Half Open connections
setItem(MAX_HALF_OPEN, PROPERTY, new QTableWidgetItem(tr("Maximum number of half-open connections [0: Disabled]")));
spin_maxhalfopen = new QSpinBox();
connect(spin_maxhalfopen, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
spin_maxhalfopen->setMinimum(0);
spin_maxhalfopen->setMaximum(99999);
spin_maxhalfopen->setValue(Preferences::getMaxHalfOpenConnections());
}
void emitSettingsChanged() {

2
src/bittorrent.cpp

@ -445,6 +445,8 @@ void Bittorrent::configureSession() { @@ -445,6 +445,8 @@ void Bittorrent::configureSession() {
// Include overhead in transfer limits
sessionSettings.rate_limit_ip_overhead = Preferences::includeOverheadInLimits();
// Bittorrent
// * Max Half-open connections
s->set_max_half_open_connections(Preferences::getMaxHalfOpenConnections());
// * Max connections limit
setMaxConnections(Preferences::getMaxConnecs());
// * Max connections per torrent limit

13
src/preferences.h

@ -916,6 +916,19 @@ public: @@ -916,6 +916,19 @@ public:
settings.setValue(QString::fromUtf8("Preferences/Connection/ResolvePeerHostNames"), resolve);
}
static int getMaxHalfOpenConnections() {
QSettings settings("qBittorrent", "qBittorrent");
const int val = settings.value(QString::fromUtf8("Preferences/Connection/MaxHalfOpenConnec"), 50).toInt();
if(val <= 0) return -1;
return val;
}
static void setMaxHalfOpenConnections(int value) {
QSettings settings("qBittorrent", "qBittorrent");
if(value <= 0) value = -1;
settings.setValue(QString::fromUtf8("Preferences/Connection/MaxHalfOpenConnec"), value);
}
};
#endif // PREFERENCES_H

Loading…
Cancel
Save