diff options
Diffstat (limited to 'src/network')
5 files changed, 20 insertions, 14 deletions
diff --git a/src/network/doc/snippets/code/src_network_socket_qabstractsocket.cpp b/src/network/doc/snippets/code/src_network_socket_qabstractsocket.cpp index 3db16b50e6..e19cb40666 100644 --- a/src/network/doc/snippets/code/src_network_socket_qabstractsocket.cpp +++ b/src/network/doc/snippets/code/src_network_socket_qabstractsocket.cpp @@ -57,9 +57,10 @@ if (socket->waitForConnected(1000)) //! [1] socket->disconnectFromHost(); - if (socket->state() == QAbstractSocket::UnconnectedState || - socket->waitForDisconnected(1000)) +if (socket->state() == QAbstractSocket::UnconnectedState + || socket->waitForDisconnected(1000)) { qDebug("Disconnected!"); +} //! [1] diff --git a/src/network/doc/snippets/code/src_network_socket_qlocalsocket_unix.cpp b/src/network/doc/snippets/code/src_network_socket_qlocalsocket_unix.cpp index 181f9c1686..deafca831d 100644 --- a/src/network/doc/snippets/code/src_network_socket_qlocalsocket_unix.cpp +++ b/src/network/doc/snippets/code/src_network_socket_qlocalsocket_unix.cpp @@ -57,6 +57,8 @@ if (socket->waitForConnected(1000)) //! [1] socket->disconnectFromServer(); -if (socket->waitForDisconnected(1000)) +if (socket->state() == QLocalSocket::UnconnectedState + || socket->waitForDisconnected(1000)) { qDebug("Disconnected!"); +} //! [1] diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 9c8f29e18a..b1ea9a4133 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -2359,11 +2359,12 @@ bool QAbstractSocket::waitForBytesWritten(int msecs) } /*! - Waits until the socket has disconnected, up to \a msecs - milliseconds. If the connection has been disconnected, this - function returns \c true; otherwise it returns \c false. In the case - where it returns \c false, you can call error() to determine - the cause of the error. + Waits until the socket has disconnected, up to \a msecs milliseconds. If the + connection was successfully disconnected, this function returns \c true; + otherwise it returns \c false (if the operation timed out, if an error + occurred, or if this QAbstractSocket is already disconnected). In the case + where it returns \c false, you can call error() to determine the cause of + the error. The following example waits up to one second for a connection to be closed: diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 1c34cd13ee..af7cdb76d2 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -287,11 +287,12 @@ QT_BEGIN_NAMESPACE /*! \fn bool QLocalSocket::waitForDisconnected(int msecs) - Waits until the socket has disconnected, up to \a msecs - milliseconds. If the connection has been disconnected, this - function returns \c true; otherwise it returns \c false. In the case - where it returns \c false, you can call error() to determine - the cause of the error. + Waits until the socket has disconnected, up to \a msecs milliseconds. If the + connection was successfully disconnected, this function returns \c true; + otherwise it returns \c false (if the operation timed out, if an error + occurred, or if this QLocalSocket is already disconnected). In the case + where it returns \c false, you can call error() to determine the cause of + the error. The following example waits up to one second for a connection to be closed: diff --git a/src/network/ssl/qsslsocket_schannel.cpp b/src/network/ssl/qsslsocket_schannel.cpp index d7fb080b49..c6e3e4d786 100644 --- a/src/network/ssl/qsslsocket_schannel.cpp +++ b/src/network/ssl/qsslsocket_schannel.cpp @@ -974,6 +974,7 @@ bool QSslSocketBackendPrivate::performHandshake() bool QSslSocketBackendPrivate::verifyHandshake() { Q_Q(QSslSocket); + sslErrors.clear(); const bool isClient = mode == QSslSocket::SslClientMode; #define CHECK_STATUS(status) \ @@ -1062,7 +1063,7 @@ bool QSslSocketBackendPrivate::verifyHandshake() } // verifyCertContext returns false if the user disconnected while it was checking errors. - if (certificateContext && sslErrors.isEmpty() && !verifyCertContext(certificateContext)) + if (certificateContext && !verifyCertContext(certificateContext)) return false; if (!checkSslErrors() || state != QAbstractSocket::ConnectedState) { |