mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 09:43:07 -07:00
- Improve Web UI settings so that the HTTP server is reconstructed only when necessary
This commit is contained in:
parent
4d00db2b42
commit
f96ec75eec
1 changed files with 15 additions and 9 deletions
|
@ -504,17 +504,23 @@ void Bittorrent::configureSession() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Bittorrent::initWebUi(QString username, QString password, int port) {
|
bool Bittorrent::initWebUi(QString username, QString password, int port) {
|
||||||
if(httpServer)
|
if(httpServer) {
|
||||||
httpServer->close();
|
if(httpServer->serverPort() != port) {
|
||||||
else
|
httpServer->close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
httpServer = new HttpServer(this, 3000, this);
|
httpServer = new HttpServer(this, 3000, this);
|
||||||
|
}
|
||||||
httpServer->setAuthorization(username, password);
|
httpServer->setAuthorization(username, password);
|
||||||
bool success = httpServer->listen(QHostAddress::Any, port);
|
bool success = true;
|
||||||
if (success)
|
if(!httpServer->isListening()) {
|
||||||
qDebug("Web UI listening on port %d", port);
|
success = httpServer->listen(QHostAddress::Any, port);
|
||||||
else
|
if (success)
|
||||||
addConsoleMessage(tr("Web User Interface Error - Unable to bind Web UI to port %1").arg(port), QColor("red"));
|
qDebug("Web UI listening on port %d", port);
|
||||||
return success;
|
else
|
||||||
|
addConsoleMessage(tr("Web User Interface Error - Unable to bind Web UI to port %1").arg(port), QColor("red"));
|
||||||
|
}
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bittorrent::takeETASamples() {
|
void Bittorrent::takeETASamples() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue