summaryrefslogtreecommitdiffstats
path: root/tests/auto/shared
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-12-11 10:55:18 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-12-11 15:52:24 +0100
commit91696b2cb090e5b6147a30465f74d8d37db48615 (patch)
treee73d4adee4f9f2040e8986b8388737d3bf866a5d /tests/auto/shared
parent1b79f9ccffe468107be5f6c5d3ad42cdcfdef585 (diff)
parentdad48eb41d1b4b4b32c73884a1c29dd6d9408c33 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'tests/auto/shared')
-rw-r--r--tests/auto/shared/httpserver.cpp10
-rw-r--r--tests/auto/shared/httpserver.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/shared/httpserver.cpp b/tests/auto/shared/httpserver.cpp
index 67f491fac..69e8cb6cc 100644
--- a/tests/auto/shared/httpserver.cpp
+++ b/tests/auto/shared/httpserver.cpp
@@ -54,6 +54,7 @@ bool HttpServer::start()
{
m_error = false;
m_expectingError = false;
+ m_ignoreNewConnection = false;
if (!m_tcpServer->listen()) {
qCWarning(gHttpServerLog).noquote() << m_tcpServer->errorString();
@@ -84,6 +85,9 @@ QUrl HttpServer::url(const QString &path) const
void HttpServer::handleNewConnection()
{
+ if (m_ignoreNewConnection)
+ return;
+
auto rr = new HttpReqRep(m_tcpServer->nextPendingConnection(), this);
connect(rr, &HttpReqRep::requestReceived, [this, rr]() {
Q_EMIT newRequest(rr);
@@ -122,5 +126,9 @@ void HttpServer::handleNewConnection()
<< error;
m_error = true;
});
- connect(rr, &HttpReqRep::closed, rr, &QObject::deleteLater);
+
+ if (!m_tcpServer->isListening()) {
+ m_ignoreNewConnection = true;
+ connect(rr, &HttpReqRep::closed, rr, &QObject::deleteLater);
+ }
}
diff --git a/tests/auto/shared/httpserver.h b/tests/auto/shared/httpserver.h
index 9764852de..952ead220 100644
--- a/tests/auto/shared/httpserver.h
+++ b/tests/auto/shared/httpserver.h
@@ -90,6 +90,7 @@ private:
QUrl m_url;
QStringList m_dirs;
bool m_error = false;
+ bool m_ignoreNewConnection = false;
bool m_expectingError = false;
};