From cced8c900561684609203667c303884fef0ea758 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Fri, 31 Jul 2020 18:04:53 +0300 Subject: Make QAbstractSocket::abort() behavior unambiguous MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After calling this function, the user expects that the connection is terminated, I/O device is closed and the socket is ready for a new attempt. But, if the socket was disconnected before the call, close() is not called and I/O device remains opened. Because QAbstractSocket::close() and QIODevice::close() can handle reentering, we can call close() unconditionally, which makes the behavior obvious. Change-Id: I90a9cbb1a1fe8f866b55ef0bd68d286b34e853f5 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/network/socket/qabstractsocket.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/network') diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 1850265141..21f1f742f7 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -2406,8 +2406,6 @@ void QAbstractSocket::abort() qDebug("QAbstractSocket::abort()"); #endif d->setWriteChannelCount(0); - if (d->state == UnconnectedState) - return; #ifndef QT_NO_SSL if (QSslSocket *socket = qobject_cast(this)) { socket->abort(); -- cgit v1.2.3