network: Add pending close on disconnect for non-empty write buffer

Similarly to 1b19f660 (which added socket flushing before close), the
socket should have a chance to disconnect if the write buffer is not
empty. Instead of flushing, the pendingClose is added so that the
backend may disconnect the socket once these bytes have been written.

Change-Id: I2d85b6356c3e158bade3d5d86161d3e33649cad6
Reviewed-by: Richard J. Moore <rich@kde.org>
bb10
Andrew Knight 2014-08-27 09:02:45 +03:00
parent ecbf6dfbf5
commit 6d57f3f27e
1 changed files with 3 additions and 1 deletions

View File

@ -1894,8 +1894,10 @@ void QSslSocket::disconnectFromHost()
emit stateChanged(d->state);
}
if (!d->writeBuffer.isEmpty())
if (!d->writeBuffer.isEmpty()) {
d->pendingClose = true;
return;
}
if (d->mode == UnencryptedMode) {
d->plainSocket->disconnectFromHost();