summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/shared
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-02-15 06:36:25 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-02-15 06:37:04 (GMT)
commit988c69de1a16080bf9646f9698ff62cc5541e0b8 (patch)
tree532e0e12390a8c58895736eaa3a5991312681a50 /tests/auto/declarative/shared
parentcebb18bbffeb16a951dbe16dde2811284f359840 (diff)
downloadQt-988c69de1a16080bf9646f9698ff62cc5541e0b8.zip
Qt-988c69de1a16080bf9646f9698ff62cc5541e0b8.tar.gz
Qt-988c69de1a16080bf9646f9698ff62cc5541e0b8.tar.bz2
Make tst_xmlhttprequest more reliable
Diffstat (limited to 'tests/auto/declarative/shared')
-rw-r--r--tests/auto/declarative/shared/testhttpserver.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/auto/declarative/shared/testhttpserver.cpp b/tests/auto/declarative/shared/testhttpserver.cpp
index 490fc95..5740925 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();
}
}