summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-14 17:15:21 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2010-06-14 17:15:21 (GMT)
commitfd96a8180a5ccfeaea5b081c42137d18d640c25e (patch)
tree573247867de97e7a163735a48791c1681b22c333 /tests
parent78e74249014b152b93dae07bf194b16769016ad0 (diff)
downloadQt-fd96a8180a5ccfeaea5b081c42137d18d640c25e.zip
Qt-fd96a8180a5ccfeaea5b081c42137d18d640c25e.tar.gz
Qt-fd96a8180a5ccfeaea5b081c42137d18d640c25e.tar.bz2
QLocalSocket/Win: call close on async connection loss
If we notice a broken pipe via _q_notified, we should call close in case the internal read buffer is empty. Auto test added: tst_QLocalSocket::asyncDisconnectNotify Reviewed-by: ossi
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index d2cba6e..1acd669 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -115,7 +115,7 @@ private slots:
void writeToClientAndDisconnect();
void debug();
void bytesWrittenSignal();
-
+ void asyncDisconnectNotify();
#ifdef Q_OS_SYMBIAN
private:
@@ -1061,6 +1061,25 @@ void tst_QLocalSocket::bytesWrittenSignal()
QVERIFY(writeThread.wait(2000));
}
+
+void tst_QLocalSocket::asyncDisconnectNotify()
+{
+#ifdef Q_OS_SYMBIAN
+ unlink("asyncDisconnectNotify");
+#endif
+
+ QLocalServer server;
+ QVERIFY(server.listen("asyncDisconnectNotify"));
+ QLocalSocket client;
+ QSignalSpy disconnectedSpy(&client, SIGNAL(disconnected()));
+ client.connectToServer("asyncDisconnectNotify");
+ QVERIFY(server.waitForNewConnection());
+ QLocalSocket* serverSocket = server.nextPendingConnection();
+ QVERIFY(serverSocket);
+ delete serverSocket;
+ QTRY_VERIFY(!disconnectedSpy.isEmpty());
+}
+
#ifdef Q_OS_SYMBIAN
void tst_QLocalSocket::unlink(QString name)
{