Skip to content

Commit

Permalink
Ensure all encrypted bytes are sent when closing QSslSocket.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
richmoore authored and The Qt Project committed May 26, 2014
1 parent 787c0d7 commit 1b19f66
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/network/ssl/qsslsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1b19f66

Please sign in to comment.