mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
- Improve Web UI settings so that the HTTP server is reconstructed only when necessary
This commit is contained in:
parent
4d00db2b42
commit
f96ec75eec
@ -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…
x
Reference in New Issue
Block a user