Browse Source

Added uTP support

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
641b38690c
  1. 1
      Changelog
  2. 9
      src/preferences/advancedsettings.h
  3. 65
      src/preferences/options.ui
  4. 34
      src/preferences/options_imp.cpp
  5. 1
      src/preferences/options_imp.h
  6. 21
      src/preferences/preferences.h
  7. 28
      src/properties/peerlistdelegate.h
  8. 83
      src/properties/peerlistwidget.cpp
  9. 3
      src/properties/peerlistwidget.h
  10. 28
      src/qtlibtorrent/qbtsession.cpp

1
Changelog

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.8.0
- FEATURE: Added full libtorrent v0.16 support (uTP, ...)
- FEATURE: Added support for secure SMTP connection (SSL)
- FEATURE: Added support for SMTP authentication
- FEATURE: Added UPnP/NAT-PMP port forward for the Web UI port

9
src/preferences/advancedsettings.h

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
#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, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT,
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT,
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
UPDATE_CHECK,
#endif
@ -28,7 +28,7 @@ class AdvancedSettings: public QTableWidget { @@ -28,7 +28,7 @@ class AdvancedSettings: public QTableWidget {
private:
QSpinBox spin_cache, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port;
QCheckBox cb_ignore_limits_lan, cb_count_overhead, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
QCheckBox cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion;
QComboBox combo_iface;
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
@ -69,8 +69,6 @@ public slots: @@ -69,8 +69,6 @@ public slots:
pref.setOutgoingPortsMax(outgoing_ports_max.value());
// Ignore limits on LAN
pref.ignoreLimitsOnLAN(cb_ignore_limits_lan.isChecked());
// Include protocol overhead in transfer limits
pref.includeOverheadInLimits(cb_count_overhead.isChecked());
// Recheck torrents on completion
pref.recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
// Transfer list refresh interval
@ -170,9 +168,6 @@ private slots: @@ -170,9 +168,6 @@ private slots:
// Ignore transfer limits on local network
cb_ignore_limits_lan.setChecked(pref.ignoreLimitsOnLAN());
setRow(IGNORE_LIMIT_LAN, tr("Ignore transfer limits on local network"), &cb_ignore_limits_lan);
// Consider protocol overhead in transfer limits
cb_count_overhead.setChecked(pref.includeOverheadInLimits());
setRow(COUNT_OVERHEAD, tr("Include TCP/IP overhead in transfer limits"), &cb_count_overhead);
// Recheck completed torrents
cb_recheck_completed.setChecked(pref.recheckTorrentsOnCompletion());
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed);

65
src/preferences/options.ui

@ -1405,16 +1405,16 @@ QGroupBox { @@ -1405,16 +1405,16 @@ QGroupBox {
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>504</width>
<height>384</height>
<y>-16</y>
<width>489</width>
<height>425</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
<item>
<widget class="QGroupBox" name="bandwidthBox">
<property name="title">
<string>Global Speed Limits</string>
<string>Global Rate Limits</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
@ -1513,13 +1513,66 @@ QGroupBox { @@ -1513,13 +1513,66 @@ QGroupBox {
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_27">
<item>
<layout class="QFormLayout" name="formLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Protocol:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBTProtocol">
<item>
<property name="text">
<string>TCP and uTP</string>
</property>
</item>
<item>
<property name="text">
<string>TCP only</string>
</property>
</item>
<item>
<property name="text">
<string>uTP only</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkLimituTPConnections">
<property name="text">
<string>Apply rate limit to uTP connections</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkLimitTransportOverhead">
<property name="text">
<string>Apply rate limit to transport overhead</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>Alternative Global Speed Limits</string>
<string>Alternative Global Rate Limits</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
@ -1625,7 +1678,7 @@ QGroupBox { @@ -1625,7 +1678,7 @@ QGroupBox {
<item>
<widget class="QGroupBox" name="check_schedule">
<property name="title">
<string>Schedule the use of alternative speed limits</string>
<string>Schedule the use of alternative rate limits</string>
</property>
<property name="checkable">
<bool>true</bool>

34
src/preferences/options_imp.cpp

@ -113,6 +113,8 @@ options_imp::options_imp(QWidget *parent): @@ -113,6 +113,8 @@ options_imp::options_imp(QWidget *parent):
comboTrayIcon->setVisible(false);
#endif
// Connect signals / slots
// Speeds
connect(comboBTProtocol, SIGNAL(currentIndexChanged(int)), SLOT(updateBTProtocolSettings(int)));
// Proxy tab
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
@ -168,6 +170,9 @@ options_imp::options_imp(QWidget *parent): @@ -168,6 +170,9 @@ options_imp::options_imp(QWidget *parent):
connect(schedule_from, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton()));
connect(schedule_to, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton()));
connect(schedule_days, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(comboBTProtocol, SIGNAL(currentIndexChanged(int)), SLOT(enableApplyButton()));
connect(checkLimituTPConnections, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
connect(checkLimitTransportOverhead, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
// Bittorrent tab
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -216,6 +221,10 @@ options_imp::options_imp(QWidget *parent): @@ -216,6 +221,10 @@ options_imp::options_imp(QWidget *parent):
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
#if LIBTORRENT_VERSION_MINOR < 15
checkAppendqB->setVisible(false);
#endif
#if LIBTORRENT_VERSION_MINOR < 16
comboBTProtocol->setVisible(false);
checkLimituTPConnections->setVisible(false);
#endif
// Load Advanced settings
QVBoxLayout *adv_layout = new QVBoxLayout();
@ -382,6 +391,9 @@ void options_imp::saveOptions(){ @@ -382,6 +391,9 @@ void options_imp::saveOptions(){
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits();
pref.setGlobalDownloadLimit(down_up_limit.first);
pref.setGlobalUploadLimit(down_up_limit.second);
pref.setBTProtocol(comboBTProtocol->currentIndex());
pref.setuTPRateLimited(checkLimituTPConnections->isChecked());
pref.includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
pref.setAltGlobalDownloadLimit(spinDownloadLimitAlt->value());
pref.setAltGlobalUploadLimit(spinUploadLimitAlt->value());
pref.setSchedulerEnabled(check_schedule->isChecked());
@ -573,6 +585,10 @@ void options_imp::loadOptions(){ @@ -573,6 +585,10 @@ void options_imp::loadOptions(){
}
spinUploadLimitAlt->setValue(pref.getAltGlobalUploadLimit());
spinDownloadLimitAlt->setValue(pref.getAltGlobalDownloadLimit());
// Options
comboBTProtocol->setCurrentIndex((int)pref.getBTProtocol());
checkLimituTPConnections->setChecked(pref.isuTPRateLimited());
checkLimitTransportOverhead->setChecked(pref.includeOverheadInLimits());
// Scheduler
check_schedule->setChecked(pref.isSchedulerEnabled());
schedule_from->setTime(pref.getSchedulerStartTime());
@ -1188,3 +1204,21 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const @@ -1188,3 +1204,21 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const
}
}
}
void options_imp::updateBTProtocolSettings(int protocol)
{
switch(protocol) {
case BT::TCP:
checkLimituTPConnections->setEnabled(false);
break;
case BT::TCP_uTP:
checkLimituTPConnections->setEnabled(true);
break;
case BT::uTP:
checkLimituTPConnections->setEnabled(true);
break;
default:
Q_ASSERT(0);
break;
}
}

1
src/preferences/options_imp.h

@ -82,6 +82,7 @@ private slots: @@ -82,6 +82,7 @@ private slots:
void on_removeScanFolderButton_clicked();
void on_registerDNSBtn_clicked();
void setLocale(const QString &locale);
void updateBTProtocolSettings(int protocol);
private:
// Methods

21
src/preferences/preferences.h

@ -62,7 +62,10 @@ namespace TrayIcon { @@ -62,7 +62,10 @@ namespace TrayIcon {
enum Style { NORMAL = 0, MONO_DARK, MONO_LIGHT };
}
namespace DNS {
enum Service { DYNDNS, NOIP };
enum Service { DYNDNS, NOIP };
}
namespace BT {
enum Protocol { TCP_uTP, TCP, uTP };
}
class Preferences : public QIniSettings {
@ -537,6 +540,22 @@ public: @@ -537,6 +540,22 @@ public:
setValue(QString::fromUtf8("Preferences/Bittorrent/MaxUploadsPerTorrent"), val);
}
BT::Protocol getBTProtocol() const {
return (BT::Protocol)value(QString::fromUtf8("Preferences/Bittorrent/Protocol"), BT::TCP_uTP).toInt();
}
void setBTProtocol(int protocol) {
setValue("Preferences/Bittorrent/Protocol", protocol);
}
bool isuTPRateLimited() const {
return value(QString::fromUtf8("Preferences/Bittorrent/uTP_rate_limiting"), false).toBool();
}
void setuTPRateLimited(bool enabled) {
setValue("Preferences/Bittorrent/uTP_rate_limiting", enabled);
}
bool isDHTEnabled() const {
return value(QString::fromUtf8("Preferences/Bittorrent/DHT"), true).toBool();
}

28
src/properties/peerlistdelegate.h

@ -35,11 +35,13 @@ @@ -35,11 +35,13 @@
#include <QPainter>
#include "misc.h"
enum PeerListColumns {IP, CLIENT, PROGRESS, DOWN_SPEED, UP_SPEED, TOT_DOWN, TOT_UP, IP_HIDDEN};
class PeerListDelegate: public QItemDelegate {
Q_OBJECT
public:
enum PeerListColumns {IP, CONNECTION, CLIENT, PROGRESS, DOWN_SPEED, UP_SPEED,
TOT_DOWN, TOT_UP, IP_HIDDEN, COL_COUNT};
public:
PeerListDelegate(QObject *parent) : QItemDelegate(parent){}
@ -56,18 +58,18 @@ public: @@ -56,18 +58,18 @@ public:
break;
case DOWN_SPEED:
case UP_SPEED:{
QItemDelegate::drawBackground(painter, opt, index);
qreal speed = index.data().toDouble();
if (speed > 0.0)
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (i.e. per second)"));
break;
}
QItemDelegate::drawBackground(painter, opt, index);
qreal speed = index.data().toDouble();
if (speed > 0.0)
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (i.e. per second)"));
break;
}
case PROGRESS:{
QItemDelegate::drawBackground(painter, opt, index);
qreal progress = index.data().toDouble();
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(progress*100., 'f', 1)+"%");
break;
}
QItemDelegate::drawBackground(painter, opt, index);
qreal progress = index.data().toDouble();
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(progress*100., 'f', 1)+"%");
break;
}
default:
QItemDelegate::paint(painter, option, index);
}

83
src/properties/peerlistwidget.cpp

@ -57,20 +57,21 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent): QTreeView(parent), pro @@ -57,20 +57,21 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent): QTreeView(parent), pro
setAllColumnsShowFocus(true);
setSelectionMode(QAbstractItemView::ExtendedSelection);
// List Model
listModel = new QStandardItemModel(0, 8);
listModel->setHeaderData(IP, Qt::Horizontal, tr("IP"));
listModel->setHeaderData(CLIENT, Qt::Horizontal, tr("Client", "i.e.: Client application"));
listModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded"));
listModel->setHeaderData(DOWN_SPEED, Qt::Horizontal, tr("Down Speed", "i.e: Download speed"));
listModel->setHeaderData(UP_SPEED, Qt::Horizontal, tr("Up Speed", "i.e: Upload speed"));
listModel->setHeaderData(TOT_DOWN, Qt::Horizontal, tr("Downloaded", "i.e: total data downloaded"));
listModel->setHeaderData(TOT_UP, Qt::Horizontal, tr("Uploaded", "i.e: total data uploaded"));
listModel = new QStandardItemModel(0, PeerListDelegate::COL_COUNT);
listModel->setHeaderData(PeerListDelegate::IP, Qt::Horizontal, tr("IP"));
listModel->setHeaderData(PeerListDelegate::CONNECTION, Qt::Horizontal, tr("Connection"));
listModel->setHeaderData(PeerListDelegate::CLIENT, Qt::Horizontal, tr("Client", "i.e.: Client application"));
listModel->setHeaderData(PeerListDelegate::PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded"));
listModel->setHeaderData(PeerListDelegate::DOWN_SPEED, Qt::Horizontal, tr("Down Speed", "i.e: Download speed"));
listModel->setHeaderData(PeerListDelegate::UP_SPEED, Qt::Horizontal, tr("Up Speed", "i.e: Upload speed"));
listModel->setHeaderData(PeerListDelegate::TOT_DOWN, Qt::Horizontal, tr("Downloaded", "i.e: total data downloaded"));
listModel->setHeaderData(PeerListDelegate::TOT_UP, Qt::Horizontal, tr("Uploaded", "i.e: total data uploaded"));
// Proxy model to support sorting without actually altering the underlying model
proxyModel = new QSortFilterProxyModel();
proxyModel->setDynamicSortFilter(true);
proxyModel->setSourceModel(listModel);
setModel(proxyModel);
hideColumn(IP_HIDDEN);
hideColumn(PeerListDelegate::IP_HIDDEN);
// Context menu
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showPeerListMenu(QPoint)));
@ -129,7 +130,7 @@ void PeerListWidget::showPeerListMenu(QPoint) { @@ -129,7 +130,7 @@ void PeerListWidget::showPeerListMenu(QPoint) {
QStringList selectedPeerIPs;
foreach(const QModelIndex &index, selectedIndexes) {
int row = proxyModel->mapToSource(index).row();
QString myip = listModel->data(listModel->index(row, IP_HIDDEN)).toString();
QString myip = listModel->data(listModel->index(row, PeerListDelegate::IP_HIDDEN)).toString();
selectedPeerIPs << myip;
}
// Add Peer Action
@ -320,30 +321,31 @@ QStandardItem* PeerListWidget::addPeer(QString ip, peer_info peer) { @@ -320,30 +321,31 @@ QStandardItem* PeerListWidget::addPeer(QString ip, peer_info peer) {
host = resolver->getHostFromCache(peer.ip);
}
if(host.isNull())
listModel->setData(listModel->index(row, IP), ip);
listModel->setData(listModel->index(row, PeerListDelegate::IP), ip);
else
listModel->setData(listModel->index(row, IP), host);
listModel->setData(listModel->index(row, IP_HIDDEN), ip);
listModel->setData(listModel->index(row, PeerListDelegate::IP), host);
listModel->setData(listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);
// Resolve peer host name is asked
if(resolver && host.isNull())
resolver->resolve(peer.ip);
if(display_flags) {
const QIcon ico = GeoIPManager::CountryISOCodeToIcon(peer.country);
if(!ico.isNull()) {
listModel->setData(listModel->index(row, IP), ico, Qt::DecorationRole);
listModel->setData(listModel->index(row, PeerListDelegate::IP), ico, Qt::DecorationRole);
const QString country_name = GeoIPManager::CountryISOCodeToName(peer.country);
listModel->setData(listModel->index(row, IP), country_name, Qt::ToolTipRole);
listModel->setData(listModel->index(row, PeerListDelegate::IP), country_name, Qt::ToolTipRole);
} else {
missingFlags.insert(ip);
}
}
listModel->setData(listModel->index(row, CLIENT), misc::toQStringU(peer.client));
listModel->setData(listModel->index(row, PROGRESS), peer.progress);
listModel->setData(listModel->index(row, DOWN_SPEED), peer.payload_down_speed);
listModel->setData(listModel->index(row, UP_SPEED), peer.payload_up_speed);
listModel->setData(listModel->index(row, TOT_DOWN), (qulonglong)peer.total_download);
listModel->setData(listModel->index(row, TOT_UP), (qulonglong)peer.total_upload);
return listModel->item(row, IP);
listModel->setData(listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer.connection_type));
listModel->setData(listModel->index(row, PeerListDelegate::CLIENT), misc::toQStringU(peer.client));
listModel->setData(listModel->index(row, PeerListDelegate::PROGRESS), peer.progress);
listModel->setData(listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payload_down_speed);
listModel->setData(listModel->index(row, PeerListDelegate::UP_SPEED), peer.payload_up_speed);
listModel->setData(listModel->index(row, PeerListDelegate::TOT_DOWN), (qulonglong)peer.total_download);
listModel->setData(listModel->index(row, PeerListDelegate::TOT_UP), (qulonglong)peer.total_upload);
return listModel->item(row, PeerListDelegate::IP);
}
void PeerListWidget::updatePeer(QString ip, peer_info peer) {
@ -352,18 +354,19 @@ void PeerListWidget::updatePeer(QString ip, peer_info peer) { @@ -352,18 +354,19 @@ void PeerListWidget::updatePeer(QString ip, peer_info peer) {
if(display_flags) {
const QIcon ico = GeoIPManager::CountryISOCodeToIcon(peer.country);
if(!ico.isNull()) {
listModel->setData(listModel->index(row, IP), ico, Qt::DecorationRole);
listModel->setData(listModel->index(row, PeerListDelegate::IP), ico, Qt::DecorationRole);
const QString country_name = GeoIPManager::CountryISOCodeToName(peer.country);
listModel->setData(listModel->index(row, IP), country_name, Qt::ToolTipRole);
listModel->setData(listModel->index(row, PeerListDelegate::IP), country_name, Qt::ToolTipRole);
missingFlags.remove(ip);
}
}
listModel->setData(listModel->index(row, CLIENT), misc::toQStringU(peer.client));
listModel->setData(listModel->index(row, PROGRESS), peer.progress);
listModel->setData(listModel->index(row, DOWN_SPEED), peer.payload_down_speed);
listModel->setData(listModel->index(row, UP_SPEED), peer.payload_up_speed);
listModel->setData(listModel->index(row, TOT_DOWN), (qulonglong)peer.total_download);
listModel->setData(listModel->index(row, TOT_UP), (qulonglong)peer.total_upload);
listModel->setData(listModel->index(row, PeerListDelegate::CONNECTION), getConnectionString(peer.connection_type));
listModel->setData(listModel->index(row, PeerListDelegate::CLIENT), misc::toQStringU(peer.client));
listModel->setData(listModel->index(row, PeerListDelegate::PROGRESS), peer.progress);
listModel->setData(listModel->index(row, PeerListDelegate::DOWN_SPEED), peer.payload_down_speed);
listModel->setData(listModel->index(row, PeerListDelegate::UP_SPEED), peer.payload_up_speed);
listModel->setData(listModel->index(row, PeerListDelegate::TOT_DOWN), (qulonglong)peer.total_download);
listModel->setData(listModel->index(row, PeerListDelegate::TOT_UP), (qulonglong)peer.total_upload);
}
void PeerListWidget::handleResolved(const QString &ip, const QString &hostname) {
@ -384,3 +387,23 @@ void PeerListWidget::handleSortColumnChanged(int col) @@ -384,3 +387,23 @@ void PeerListWidget::handleSortColumnChanged(int col)
proxyModel->setSortRole(Qt::DisplayRole);
}
}
QString PeerListWidget::getConnectionString(int connection_type)
{
QString connection;
switch(connection_type) {
#if LIBTORRENT_VERSION_MINOR > 15
case peer_info::bittorrent_utp:
connection = "uTP";
break;
case peer_info::http_seed:
#endif
case peer_info::web_seed:
connection = "Web";
break;
default:
connection = "BT";
break;
}
return connection;
}

3
src/properties/peerlistwidget.h

@ -82,6 +82,9 @@ protected slots: @@ -82,6 +82,9 @@ protected slots:
void banSelectedPeers(QStringList peer_ips);
void handleSortColumnChanged(int col);
private:
static QString getConnectionString(int connection_type);
private:
QStandardItemModel *listModel;
PeerListDelegate *listDelegate;

28
src/qtlibtorrent/qbtsession.cpp

@ -453,6 +453,34 @@ void QBtSession::configureSession() { @@ -453,6 +453,34 @@ void QBtSession::configureSession() {
s->set_max_half_open_connections(pref.getMaxHalfOpenConnections());
// * Max connections limit
setMaxConnections(pref.getMaxConnecs());
#endif
#if LIBTORRENT_VERSION_MINOR > 15
// uTP
switch((int)pref.getBTProtocol()) {
case BT::TCP_uTP:
sessionSettings.enable_incoming_tcp = true;
sessionSettings.enable_outgoing_tcp = true;
sessionSettings.enable_incoming_utp = true;
sessionSettings.enable_outgoing_utp = true;
break;
case BT::TCP:
sessionSettings.enable_incoming_tcp = true;
sessionSettings.enable_outgoing_tcp = true;
sessionSettings.enable_incoming_utp = false;
sessionSettings.enable_outgoing_utp = false;
break;
case BT::uTP:
sessionSettings.enable_incoming_tcp = false;
sessionSettings.enable_outgoing_tcp = false;
sessionSettings.enable_incoming_utp = true;
sessionSettings.enable_outgoing_utp = true;
break;
default:
Q_ASSERT(0);
break;
}
// uTP rate limiting
sessionSettings.rate_limit_utp = pref.isuTPRateLimited();
#endif
qDebug() << "Settings SessionSettings";
setSessionSettings(sessionSettings);

Loading…
Cancel
Save