QAbstractSocket: clear error code to match the error description
Since 5.10, QIODevice resets the error string on opening. So, we should set the error code to UnknownSocketError accordingly. Change-Id: I0dd314788ffc182d6837f9d06b51e41d6de59d7e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
b08c195264
commit
d02a6b938e
|
|
@ -1694,6 +1694,8 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port,
|
|||
}
|
||||
#endif
|
||||
|
||||
// Sync up with error string, which open() shall clear.
|
||||
d->socketError = UnknownSocketError;
|
||||
if (openMode & QIODevice::Unbuffered)
|
||||
d->isBuffered = false;
|
||||
else if (!d_func()->isBuffered)
|
||||
|
|
@ -1929,6 +1931,8 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState
|
|||
return false;
|
||||
}
|
||||
|
||||
// Sync up with error string, which open() shall clear.
|
||||
d->socketError = UnknownSocketError;
|
||||
if (d->threadData->hasEventDispatcher())
|
||||
d->socketEngine->setReceiver(d);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ public:
|
|||
QAbstractSocket::SocketType socketType;
|
||||
QAbstractSocket::SocketState state;
|
||||
|
||||
// Must be kept in sync with QIODevicePrivate::errorString.
|
||||
QAbstractSocket::SocketError socketError;
|
||||
|
||||
QAbstractSocket::NetworkLayerProtocol preferredNetworkLayerProtocol;
|
||||
|
|
|
|||
Loading…
Reference in New Issue