summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslsocket_openssl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/ssl/qsslsocket_openssl.cpp')
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 3b2de7a05b..d515f27865 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -934,8 +934,11 @@ void QSslSocketBackendPrivate::transmit()
#ifdef QSSLSOCKET_DEBUG
qDebug() << "QSslSocketBackendPrivate::transmit: remote disconnect";
#endif
- plainSocket->disconnectFromHost();
- break;
+ shutdown = true; // the other side shut down, make sure we do not send shutdown ourselves
+ q->setErrorString(QSslSocket::tr("The TLS/SSL connection has been closed"));
+ q->setSocketError(QAbstractSocket::RemoteHostClosedError);
+ emit q->error(QAbstractSocket::RemoteHostClosedError);
+ return;
case SSL_ERROR_SYSCALL: // some IO error
case SSL_ERROR_SSL: // error in the SSL library
// we do not know exactly what the error is, nor whether we can recover from it,
@@ -1369,8 +1372,11 @@ void QWindowsCaRootFetcher::start()
void QSslSocketBackendPrivate::disconnectFromHost()
{
if (ssl) {
- q_SSL_shutdown(ssl);
- transmit();
+ if (!shutdown) {
+ q_SSL_shutdown(ssl);
+ shutdown = true;
+ transmit();
+ }
}
plainSocket->disconnectFromHost();
}