mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-09 06:17:58 +00:00
- qBittorrent no longer listens on a random port whenever it receives a listen_failed_alert (because it may correspond to another network interface)
- Display a "disconnected" icon in status bar whenever qBittorrent fails to listen on the selected port
This commit is contained in:
parent
7ad90b1b80
commit
2168d5a30e
BIN
src/Icons/skin/disconnected.png
Executable file
BIN
src/Icons/skin/disconnected.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -1705,18 +1705,6 @@ void Bittorrent::readAlerts() {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (listen_failed_alert* p = dynamic_cast<listen_failed_alert*>(a.get())) {
|
||||
// Level: fatal
|
||||
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())) {
|
||||
QTorrentHandle h(p->handle);
|
||||
qDebug("Received a torrent_paused_alert for %s", h.hash().toLocal8Bit().data());
|
||||
|
@ -60,6 +60,7 @@
|
||||
<file>Icons/skin/exit.png</file>
|
||||
<file>Icons/skin/delete_all.png</file>
|
||||
<file>Icons/skin/splash.png</file>
|
||||
<file>Icons/skin/disconnected.png</file>
|
||||
<file>Icons/skin/decrease.png</file>
|
||||
<file>Icons/skin/uploading.png</file>
|
||||
<file>Icons/skin/filterall.png</file>
|
||||
|
@ -142,13 +142,18 @@ public slots:
|
||||
void refreshStatusBar() {
|
||||
// Update connection status
|
||||
session_status sessionStatus = BTSession->getSessionStatus();
|
||||
if(sessionStatus.has_incoming_connections) {
|
||||
// Connection OK
|
||||
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/connected.png")));
|
||||
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Online"));
|
||||
}else{
|
||||
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/firewalled.png")));
|
||||
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>"));
|
||||
if(!BTSession->getSession()->is_listening()) {
|
||||
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/disconnected.png")));
|
||||
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
|
||||
} else {
|
||||
if(sessionStatus.has_incoming_connections) {
|
||||
// Connection OK
|
||||
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/connected.png")));
|
||||
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Online"));
|
||||
}else{
|
||||
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/firewalled.png")));
|
||||
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>"));
|
||||
}
|
||||
}
|
||||
// Update Number of DHT nodes
|
||||
if(BTSession->isDHTEnabled()) {
|
||||
|
Loading…
Reference in New Issue
Block a user