wasm: fix QTcpSocket error code when url doesn't exist
::connect on wasm seems to be returning 0 in the instance that the server url does not exist. So we ignore that and look at errno, which returns ENOENT which makes no sense here. Fixes: QTBUG-132191 Pick-to: 6.9 Change-Id: I2ff6642dd836324e1af6c288c53880de028ce158 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
1a580ca2a9
commit
1a8c8ffb0c
@ -401,6 +401,7 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
|
||||
break;
|
||||
case ECONNREFUSED:
|
||||
case EINVAL:
|
||||
case ENOENT:
|
||||
setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString);
|
||||
socketState = QAbstractSocket::UnconnectedState;
|
||||
break;
|
||||
|
@ -109,6 +109,11 @@ static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SO
|
||||
int ret;
|
||||
// Solaris e.g. expects a non-const 2nd parameter
|
||||
QT_EINTR_LOOP(ret, QT_SOCKET_CONNECT(sockfd, const_cast<struct sockaddr *>(addr), addrlen));
|
||||
#ifdef Q_OS_WASM
|
||||
// ::connect on wasm returns 0 when it shouldn't so use errno instead
|
||||
if (errno != 0)
|
||||
ret = -1;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
#undef QT_SOCKET_CONNECT
|
||||
|
Loading…
x
Reference in New Issue
Block a user