mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Don't unnecessarily restart Web server
When related settings hasn't changed.
This commit is contained in:
parent
213b6e316c
commit
9d7dad4a61
@ -68,6 +68,9 @@ void WebUI::configure()
|
|||||||
|
|
||||||
// http server
|
// http server
|
||||||
const QString serverAddressString = pref->getWebUiAddress();
|
const QString serverAddressString = pref->getWebUiAddress();
|
||||||
|
const auto serverAddress = ((serverAddressString == u"*") || serverAddressString.isEmpty())
|
||||||
|
? QHostAddress::Any : QHostAddress(serverAddressString);
|
||||||
|
|
||||||
if (!m_httpServer)
|
if (!m_httpServer)
|
||||||
{
|
{
|
||||||
m_webapp = new WebApplication(app(), this);
|
m_webapp = new WebApplication(app(), this);
|
||||||
@ -75,8 +78,7 @@ void WebUI::configure()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((m_httpServer->serverAddress().toString() != serverAddressString)
|
if ((m_httpServer->serverAddress() != serverAddress) || (m_httpServer->serverPort() != port))
|
||||||
|| (m_httpServer->serverPort() != port))
|
|
||||||
m_httpServer->close();
|
m_httpServer->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,9 +105,7 @@ void WebUI::configure()
|
|||||||
|
|
||||||
if (!m_httpServer->isListening())
|
if (!m_httpServer->isListening())
|
||||||
{
|
{
|
||||||
const auto address = ((serverAddressString == u"*") || serverAddressString.isEmpty())
|
const bool success = m_httpServer->listen(serverAddress, port);
|
||||||
? QHostAddress::Any : QHostAddress(serverAddressString);
|
|
||||||
bool success = m_httpServer->listen(address, port);
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
LogMsg(tr("Web UI: Now listening on IP: %1, port: %2").arg(serverAddressString).arg(port));
|
LogMsg(tr("Web UI: Now listening on IP: %1, port: %2").arg(serverAddressString).arg(port));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user