mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-24 07:55:35 +08:00
Remove redundant checks in CNetworkUtils::getKnownLocalIpV4Addresses()
refs #869
This commit is contained in:
committed by
Mathew Sutcliffe
parent
7edd1bb621
commit
98b2061d3d
@@ -94,17 +94,14 @@ namespace BlackMisc
|
||||
QStringList CNetworkUtils::getKnownLocalIpV4Addresses()
|
||||
{
|
||||
QStringList ips;
|
||||
if (!CNetworkUtils::hasConnectedInterface(false)) {return ips; }
|
||||
for (const QHostAddress &address : QNetworkInterface::allAddresses())
|
||||
const QList<QHostAddress> allAddresses = QNetworkInterface::allAddresses();
|
||||
for (const QHostAddress &address : allAddresses)
|
||||
{
|
||||
if (address.isLoopback() || address.isNull()) continue;
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol && address != QHostAddress(QHostAddress::LocalHost))
|
||||
if (address.isNull()) { continue; }
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol)
|
||||
{
|
||||
QString a = address.toString();
|
||||
if (CNetworkUtils::isValidIPv4Address(a))
|
||||
{
|
||||
ips.append(a);
|
||||
}
|
||||
ips.append(a);
|
||||
}
|
||||
}
|
||||
ips.sort();
|
||||
|
||||
Reference in New Issue
Block a user