From ed19c0875e9a2485dcd2cbab3f603611ad0b19c9 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 16 Oct 2012 18:25:01 +0200 Subject: [PATCH] QSslSocket: Allow disconnections within the connected() signal When doing happy eyeballs style network state lookup, we might have to close an SSL socket from its connected signal. This can cause the warning: QSslSocket::startClientEncryption: cannot start handshake when not connected The signal should be emitted after we called startClientEncryption to avoid this warning. In that case it will initialize the encryption and ramp it down right after. Change-Id: I0c8c79cad7f91f0088b87c5e4ee8aafbc688411c Reviewed-by: Shane Kearns --- src/network/ssl/qsslsocket.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 8260c1c563..e97cf0817a 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -2153,11 +2153,13 @@ void QSslSocketPrivate::_q_connectedSlot() qDebug() << "\tlocal =" << QHostInfo::fromName(q->localAddress().toString()).hostName() << q->localAddress() << q->localPort(); #endif + + if (autoStartHandshake) + q->startClientEncryption(); + emit q->connected(); - if (autoStartHandshake) { - q->startClientEncryption(); - } else if (pendingClose) { + if (pendingClose && !autoStartHandshake) { pendingClose = false; q->disconnectFromHost(); }