diff options
Diffstat (limited to 'tests/auto/declarative/shared/testhttpserver.cpp')
-rw-r--r-- | tests/auto/declarative/shared/testhttpserver.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/auto/declarative/shared/testhttpserver.cpp b/tests/auto/declarative/shared/testhttpserver.cpp index fe2b2cf..5d56327 100644 --- a/tests/auto/declarative/shared/testhttpserver.cpp +++ b/tests/auto/declarative/shared/testhttpserver.cpp @@ -190,13 +190,14 @@ void TestHTTPServer::disconnected() --ii; } } + socket->disconnect(); socket->deleteLater(); } void TestHTTPServer::readyRead() { QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender()); - if (!socket) return; + if (!socket || socket->state() == QTcpSocket::ClosingState) return; QByteArray ba = socket->readAll(); @@ -222,14 +223,14 @@ void TestHTTPServer::readyRead() QByteArray data = ba.mid(ii); qWarning() << "TestHTTPServer: Unexpected data" << data << "\nExpected: " << waitData; m_hasFailed = true; - socket->disconnect(); + socket->disconnectFromHost(); return; } } if (waitData.isEmpty()) { socket->write(replyData); - socket->disconnect(); + socket->disconnectFromHost(); } } @@ -316,8 +317,8 @@ void TestHTTPServer::serveGET(QTcpSocket *socket, const QByteArray &data) } dataCache.remove(socket); - if (close) - socket->close(); + if (close) + socket->disconnectFromHost(); } } |