Fix build without features.networkinterface
Change-Id: I9fd2a7ec402a1d2d99e30f08554d86f18c6424ff Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
116ade88ea
commit
b53c229a4b
@ -286,8 +286,10 @@ public:
|
||||
bool checkProxy(const QHostAddress &address);
|
||||
bool fetchConnectionParameters();
|
||||
|
||||
#if QT_CONFIG(networkinterface)
|
||||
static uint scopeIdFromString(const QString &scopeid)
|
||||
{ return QNetworkInterface::interfaceIndexFromName(scopeid); }
|
||||
#endif
|
||||
|
||||
/*! \internal
|
||||
Sets \a address and \a port in the \a aa sockaddr structure and the size in \a sockAddrSize.
|
||||
@ -301,7 +303,9 @@ public:
|
||||
|| socketProtocol == QAbstractSocket::AnyIPProtocol) {
|
||||
memset(&aa->a6, 0, sizeof(sockaddr_in6));
|
||||
aa->a6.sin6_family = AF_INET6;
|
||||
#if QT_CONFIG(networkinterface)
|
||||
aa->a6.sin6_scope_id = scopeIdFromString(address.scopeId());
|
||||
#endif
|
||||
aa->a6.sin6_port = htons(port);
|
||||
Q_IPV6ADDR tmp = address.toIPv6Address();
|
||||
memcpy(&aa->a6.sin6_addr, &tmp, sizeof(tmp));
|
||||
|
@ -121,8 +121,10 @@ static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *po
|
||||
QHostAddress tmpAddress;
|
||||
tmpAddress.setAddress(tmp);
|
||||
*addr = tmpAddress;
|
||||
#if QT_CONFIG(networkinterface)
|
||||
if (s->a6.sin6_scope_id)
|
||||
addr->setScopeId(QNetworkInterface::interfaceNameFromIndex(s->a6.sin6_scope_id));
|
||||
#endif
|
||||
}
|
||||
if (port)
|
||||
*port = ntohs(s->a6.sin6_port);
|
||||
|
Loading…
Reference in New Issue
Block a user