Skip to content
Snippets Groups Projects
Commit cd966329 authored by Kai Koehne's avatar Kai Koehne
Browse files

QtSingleApplication: Don't hang if client does not send data


Do not wait forever when trying to read data from a connection. The
client might already have been giving up, and the socket therefore
become invalid without any data arriving.

Task-number: QTCREATORBUG-6467
Change-Id: Ie2e52709c92c25539491315bb5106b653df3fe8e
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
parent 747ba7f9
No related branches found
No related tags found
No related merge requests found
...@@ -139,8 +139,11 @@ void QtLocalPeer::receiveConnection() ...@@ -139,8 +139,11 @@ void QtLocalPeer::receiveConnection()
return; return;
// Why doesn't Qt have a blocking stream that takes care of this shait??? // Why doesn't Qt have a blocking stream that takes care of this shait???
while (socket->bytesAvailable() < static_cast<int>(sizeof(quint32))) while (socket->bytesAvailable() < static_cast<int>(sizeof(quint32))) {
socket->waitForReadyRead(); if (!socket->isValid()) // stale request
return;
socket->waitForReadyRead(1000);
}
QDataStream ds(socket); QDataStream ds(socket);
QByteArray uMsg; QByteArray uMsg;
quint32 remaining; quint32 remaining;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment