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,16 +504,22 @@ void Bittorrent::configureSession() {
|
||||
}
|
||||
|
||||
bool Bittorrent::initWebUi(QString username, QString password, int port) {
|
||||
if(httpServer)
|
||||
if(httpServer) {
|
||||
if(httpServer->serverPort() != port) {
|
||||
httpServer->close();
|
||||
else
|
||||
}
|
||||
} else {
|
||||
httpServer = new HttpServer(this, 3000, this);
|
||||
}
|
||||
httpServer->setAuthorization(username, password);
|
||||
bool success = httpServer->listen(QHostAddress::Any, port);
|
||||
bool success = true;
|
||||
if(!httpServer->isListening()) {
|
||||
success = httpServer->listen(QHostAddress::Any, port);
|
||||
if (success)
|
||||
qDebug("Web UI listening on port %d", port);
|
||||
else
|
||||
addConsoleMessage(tr("Web User Interface Error - Unable to bind Web UI to port %1").arg(port), QColor("red"));
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user