Skip to content

Commit

Permalink
Merge pull request #7549 from fmatthew5876/master
Browse files Browse the repository at this point in the history
Report TCPServer errorString() if webui fails to listen to port
  • Loading branch information
Chocobo1 committed Oct 11, 2017
2 parents 2977ba9 + 5185eeb commit e075012
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/webui/webui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

#include "webui.h"

#ifdef DISABLE_GUI
#include <QCoreApplication>
#endif

#include "base/http/server.h"
#include "base/logger.h"
#include "base/net/dnsupdater.h"
Expand Down Expand Up @@ -90,10 +94,17 @@ void WebUI::init()

if (!m_httpServer->isListening()) {
bool success = m_httpServer->listen(QHostAddress::Any, m_port);
if (success)
if (success) {
logger->addMessage(tr("Web UI: Now listening on port %1").arg(m_port));
else
logger->addMessage(tr("Web UI: Unable to bind to port %1").arg(m_port), Log::CRITICAL);
}
else {
const QString errorMsg = tr("Web UI: Unable to bind to port %1. %2").arg(m_port).arg(m_httpServer->errorString());
logger->addMessage(errorMsg, Log::CRITICAL);
#ifdef DISABLE_GUI
qCritical() << errorMsg;
QCoreApplication::exit(1);
#endif
}
}

// DynDNS
Expand Down

0 comments on commit e075012

Please sign in to comment.