Ensure all encrypted bytes are sent when closing QSslSocket.

If you do sock->write(data) followed by sock->close() then the data
written is not transmitted unless you flush when using QSslSocket but
is when using QTcpSocket. This change makes QSslSocket work like
QTcpSocket.

Change-Id: Ia2e1c021dc48ac0d573f78da782ea77641c03bc1
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
This commit is contained in:
Richard J. Moore 2014-05-25 21:39:22 +01:00 committed by The Qt Project
parent 787c0d76a2
commit 1b19f66037

View File

@ -777,6 +777,8 @@ void QSslSocket::close()
qDebug() << "QSslSocket::close()";
#endif
Q_D(QSslSocket);
if (encryptedBytesToWrite())
flush();
if (d->plainSocket)
d->plainSocket->close();
QTcpSocket::close();