From 1b19f66037bd4942b7e699628f9bd8bde89a69bb Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sun, 25 May 2014 21:39:22 +0100 Subject: [PATCH] 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 --- src/network/ssl/qsslsocket.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index c5ae517fb0..de6e879a71 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -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();