From 622d9701cb01f97760225dbc7c5281ab3d6a6bf2 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 29 Dec 2009 10:13:21 +0000 Subject: [PATCH] - Fix possible issues with DHT service port --- Changelog | 1 + src/bittorrent.cpp | 19 ++++++++----------- src/options_imp.cpp | 2 -- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Changelog b/Changelog index f19172947..f1bea945d 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ - BUGFIX: Fix PeerGuardian .p2b binary filter support - BUGFIX: Fix possible crash when closing a search engine tab - BUGFIX: Make sure service port does not change + - BUGFIX: Fix possible DHT port saving issue * Wed Dec 23 2009 - Christophe Dumez - v2.0.3 - BUGFIX: Minor cosmetic fix to program preferences diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 3799ed151..3856fc1c9 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -241,15 +241,10 @@ void Bittorrent::configureSession() { // Connection // * Ports binding unsigned short old_listenPort = getListenPort(); - unsigned short new_listenPort; - if(old_listenPort != Preferences::getSessionPort()) { - setListeningPort(Preferences::getSessionPort()); - new_listenPort = getListenPort(); - if(new_listenPort != old_listenPort) { - addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort))); - } - } else { - new_listenPort = old_listenPort; + unsigned short new_listenPort = Preferences::getSessionPort(); + if(old_listenPort != new_listenPort) { + setListeningPort(new_listenPort); + addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort))); } // * Global download limit int down_limit = Preferences::getGlobalDownloadLimit(); @@ -351,8 +346,10 @@ void Bittorrent::configureSession() { if(Preferences::isDHTEnabled()) { // Set DHT Port if(enableDHT(true)) { - int dht_port = new_listenPort; - if(!Preferences::isDHTPortSameAsBT()) + int dht_port; + if(Preferences::isDHTPortSameAsBT()) + dht_port = 0; + else dht_port = Preferences::getDHTPort(); setDHTPort(dht_port); addConsoleMessage(tr("DHT support [ON], port: UDP/%1").arg(dht_port), QString::fromUtf8("blue")); diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 8addc9424..f0f30b6cf 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -868,8 +868,6 @@ bool options_imp::systrayIntegration() const{ } int options_imp::getDHTPort() const { - if(isDHTPortSameAsBT()) - return 0; return spinDHTPort->value(); }