summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Fernandez <jesus.fernandez@qt.io>2018-01-30 12:26:54 +0100
committerJesus Fernandez <Jesus.Fernandez@qt.io>2018-02-15 11:29:53 +0000
commit961198b42104ea644580b14e763ec87bda0e966c (patch)
treeb836b56d1c2c33af50631090940eff0941c35c49
parent5a39420de0bb981be83d988b93ebc70906a4296e (diff)
Show more information when the HTTP server fails to initialize
When the HTTP server fails to initialize a simple message was shown in the terminal. This patch adds the error string from the QTcpServer to give more information about the problem. Change-Id: Ic52d4a78991e1c5a20f2712ca6cbbdd0738d47e0 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/plugins/platforms/webgl/qwebglhttpserver.cpp6
-rw-r--r--src/plugins/platforms/webgl/qwebglhttpserver.h2
-rw-r--r--src/plugins/platforms/webgl/qwebglintegration.cpp6
3 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/platforms/webgl/qwebglhttpserver.cpp b/src/plugins/platforms/webgl/qwebglhttpserver.cpp
index e932abf..133163e 100644
--- a/src/plugins/platforms/webgl/qwebglhttpserver.cpp
+++ b/src/plugins/platforms/webgl/qwebglhttpserver.cpp
@@ -140,6 +140,12 @@ void QWebGLHttpServer::setCustomRequestDevice(const QString &name, QIODevice *de
d->customRequestDevices.insert(name, device);
}
+QString QWebGLHttpServer::errorString() const
+{
+ Q_D(const QWebGLHttpServer);
+ return d->server.errorString();
+}
+
void QWebGLHttpServer::clientConnected()
{
Q_D(QWebGLHttpServer);
diff --git a/src/plugins/platforms/webgl/qwebglhttpserver.h b/src/plugins/platforms/webgl/qwebglhttpserver.h
index b374831..3fb382f 100644
--- a/src/plugins/platforms/webgl/qwebglhttpserver.h
+++ b/src/plugins/platforms/webgl/qwebglhttpserver.h
@@ -58,6 +58,8 @@ public:
QIODevice *customRequestDevice(const QString &name);
void setCustomRequestDevice(const QString &name, QIODevice *device);
+ QString errorString() const;
+
private slots:
void clientConnected();
void clientDisconnected();
diff --git a/src/plugins/platforms/webgl/qwebglintegration.cpp b/src/plugins/platforms/webgl/qwebglintegration.cpp
index 1db869e..679b389 100644
--- a/src/plugins/platforms/webgl/qwebglintegration.cpp
+++ b/src/plugins/platforms/webgl/qwebglintegration.cpp
@@ -115,8 +115,10 @@ void QWebGLIntegration::initialize()
d->webSocketServer = new QWebGLWebSocketServer;
d->httpServer = new QWebGLHttpServer(d->webSocketServer, this);
bool ok = d->httpServer->listen(QHostAddress::Any, d->httpPort);
- if (!ok)
- qFatal("QWebGLIntegration::initialize: Failed to initialize");
+ if (!ok) {
+ qFatal("QWebGLIntegration::initialize: Failed to initialize: %s",
+ qPrintable(d->httpServer->errorString()));
+ }
d->webSocketServerThread = new QThread(this);
d->webSocketServerThread->setObjectName("WebSocketServer");
d->webSocketServer->moveToThread(d->webSocketServerThread);