- Fix possible issues with DHT service port

This commit is contained in:
Christophe Dumez
2009-12-29 10:13:21 +00:00
parent 93c4b521bb
commit 622d9701cb
3 changed files with 9 additions and 13 deletions

View File

@@ -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"));