Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
None
-
5.3.1
-
None
-
Debian 7.6 running on Linux beaglebone 3.8.13-bone62 armv7l GNU/Linux
Description
Hi
QSslSocket::waitForReadyRead() seems to be broken in this case:
// Write message to the socket:
socket->write(data);
socket->waitForBytesWritten(msecs);
// Synchronous wait for response
socket->waitForReadyRead(msecs);
waitForReadyRead always waits until timeout and returns false.
However the other side alredy send response:
socket->encryptedBytesAvailable() is after timeout greater then 0.
If i connect slot to socket readRead() signal, i can read data without problems. But i have to use synchronous api this time.
So received data are already in the QTcpSocket buffer but they are not decrypted until control gets back to the event loop.
I have fixed this by subclasing QSslSocket and overwrite waitForReadyRead() method (using private headers). Change part is here:
// test readyReadEmitted first because either operation above
// (waitForEncrypted or transmit) may have set it
while (!readyReadEmitted &&
d->plainSocket->waitForReadyRead(qt_timeout_value(msecs, stopWatch.elapsed()))) {
// FIXED HERE
if (encryptedBytesAvailable() > 0)
}
Now waitForReadyRead() works as expected.
It seems like a bug for me.
Correct me if i'm wrong.
Is my solution correct?
Thanks.