diff options
author | Robin Burchell <robin.burchell@jollamobile.com> | 2014-03-20 23:21:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-21 00:09:29 +0100 |
commit | aa578c4e296a3bf5117fd878fcac70d1c11bd255 (patch) | |
tree | 3ae73880b0054c99d645bdab3d1d5a043c51ac43 /tests/manual | |
parent | 8f49f50a169db85401eb37daf4fe3a0fc3280603 (diff) |
TestHTTPServer: Make listening an explicit operation that reports failure.
Use this to print the error message when listening fails, and switch to always
stack allocating TestHTTPServer instances for easier cleanup.
Change-Id: I63b2bd38963b66611dc08a5c322615d91a91e675
Reviewed-by: John Brooks <john.brooks@dereferenced.net>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/httpserver/main.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/manual/httpserver/main.cpp b/tests/manual/httpserver/main.cpp index ea729547ce..4ad44508b0 100644 --- a/tests/manual/httpserver/main.cpp +++ b/tests/manual/httpserver/main.cpp @@ -112,7 +112,11 @@ int main(int argc, char *argv[]) << "\":\n\n" << QDir(directory).entryList(QDir::Files).join(QLatin1Char('\n')) << "\n\non http://localhost:" << port << '\n'; - TestHTTPServer server(port); + TestHTTPServer server; + if (!server.listen(port)) { + std::wcout << "Couldn't listen on port " << port << server.errorString().toLocal8Bit(); + exit(-1); + } server.serveDirectory(directory); return a.exec(); |