summaryrefslogtreecommitdiffstats
path: root/examples/httpserver
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2019-11-11 21:40:27 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2020-02-18 12:17:22 +0100
commit93ff67a3fce7ebe477085541217eef4000e310be (patch)
treeed5892ff3e9c30978f5dfa50004aeb4a6cd27e3d /examples/httpserver
parent4b87afbbe6132b03d114cce1cbb7958cf1f3bac8 (diff)
Make QAbstractHttpServer::listen return 0 on fail
Which then makes it compatible with other listen() functions in Qt in the sense that doing if (server.listen()) will behave consistently. Ports being listened to can then be gotten from the new serverPorts() function, mirroring serverPort() from QTcpServer etc., except it's a QVector. This is a source incompatible change, but is allowed because this module is still in tech preview. Fixes: QTBUG-79411 Change-Id: I09764afbf8fd866af4f43ab90fcf9c2e9a373237 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
Diffstat (limited to 'examples/httpserver')
-rw-r--r--examples/httpserver/simple/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/httpserver/simple/main.cpp b/examples/httpserver/simple/main.cpp
index 0bf21e2..1f10553 100644
--- a/examples/httpserver/simple/main.cpp
+++ b/examples/httpserver/simple/main.cpp
@@ -113,9 +113,9 @@ int main(int argc, char *argv[])
});
const auto port = httpServer.listen(QHostAddress::Any);
- if (port == -1) {
+ if (!port) {
qDebug() << QCoreApplication::translate(
- "QHttpServerExample", "Could not run on http://127.0.0.1:%1/").arg(port);
+ "QHttpServerExample", "Server failed to listen on a port.");
return 0;
}