Browse Source

FEATURE: Fall back to a random port if qBittorrent could not listen on the chosen port

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
396427e3b6
  1. 1
      Changelog
  2. 12
      src/bittorrent.cpp

1
Changelog

@ -23,6 +23,7 @@ @@ -23,6 +23,7 @@
- FEATURE: Show official documentation when pressing F1 key
- FEATURE: Search engine plugins now handle HTTP protocol gzip compression
- FEATURE: Enabled lazy bitfield as a counter-measure for ISP speed throttling
- FEATURE: Fall back to a random port if qBittorrent could not listen on the chosen port
- FEATURE: Announce to all trackers specified for a torrent (µTorrent behavior) (libtorrent >= v0.15 only)
- FEATURE: Added per-torrent super seeding mode (libtorrent >= v0.15 only)
- FEATURE: Support for storing symbolic links in .torrent files (libtorrent >= v0.15 only)

12
src/bittorrent.cpp

@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
#include <QString>
#include <QTimer>
#include <QSettings>
#include <stdlib.h>
#include "filesystemwatcher.h"
#include "bittorrent.h"
@ -1496,9 +1497,16 @@ void Bittorrent::readAlerts() { @@ -1496,9 +1497,16 @@ void Bittorrent::readAlerts() {
}
}
}
else if (dynamic_cast<listen_failed_alert*>(a.get())) {
else if (listen_failed_alert* p = dynamic_cast<listen_failed_alert*>(a.get())) {
// Level: fatal
addConsoleMessage(tr("Couldn't listen on any of the given ports."), QString::fromUtf8("red"));
int tried_port = p->endpoint.port();
srand(time(0));
int fallback_port = tried_port;
do {
fallback_port = rand() % 64512 + 1024;
} while(fallback_port == tried_port);
addConsoleMessage(tr("Couldn't listen on port %1, using %2 instead.").arg(QString::number(tried_port)).arg(QString::number(fallback_port)), QString::fromUtf8("red"));
setListeningPort(fallback_port);
//emit portListeningFailure();
}
/*else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())) {

Loading…
Cancel
Save