Browse Source

Don't unnecessarily restart Web server

When related settings hasn't changed.
adaptive-webui-19844
Chocobo1 1 year ago
parent
commit
9d7dad4a61
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 10
      src/webui/webui.cpp

10
src/webui/webui.cpp

@ -68,6 +68,9 @@ void WebUI::configure() @@ -68,6 +68,9 @@ void WebUI::configure()
// http server
const QString serverAddressString = pref->getWebUiAddress();
const auto serverAddress = ((serverAddressString == u"*") || serverAddressString.isEmpty())
? QHostAddress::Any : QHostAddress(serverAddressString);
if (!m_httpServer)
{
m_webapp = new WebApplication(app(), this);
@ -75,8 +78,7 @@ void WebUI::configure() @@ -75,8 +78,7 @@ void WebUI::configure()
}
else
{
if ((m_httpServer->serverAddress().toString() != serverAddressString)
|| (m_httpServer->serverPort() != port))
if ((m_httpServer->serverAddress() != serverAddress) || (m_httpServer->serverPort() != port))
m_httpServer->close();
}
@ -103,9 +105,7 @@ void WebUI::configure() @@ -103,9 +105,7 @@ void WebUI::configure()
if (!m_httpServer->isListening())
{
const auto address = ((serverAddressString == u"*") || serverAddressString.isEmpty())
? QHostAddress::Any : QHostAddress(serverAddressString);
bool success = m_httpServer->listen(address, port);
const bool success = m_httpServer->listen(serverAddress, port);
if (success)
{
LogMsg(tr("Web UI: Now listening on IP: %1, port: %2").arg(serverAddressString).arg(port));

Loading…
Cancel
Save