MCPcopy Create free account
hub / github.com/KDAB/GammaRay / foreach

Function foreach

core/remote/tcpserverdevice.cpp:53–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51{
52 QString firstHostFound;
53 foreach (const QNetworkInterface &inter, QNetworkInterface::allInterfaces()) {
54 if (!(inter.flags() & QNetworkInterface::IsUp)
55 || !(inter.flags() & QNetworkInterface::IsRunning)
56 || (inter.flags() & QNetworkInterface::IsLoopBack))
57 continue;
58
59 foreach (const QNetworkAddressEntry &addrEntry, inter.addressEntries()) {
60 const QHostAddress addr = addrEntry.ip();
61
62 // Return the ip according to the listening server protocol.
63 if (addr.protocol() != m_server->serverAddress().protocol()
64 || !addr.scopeId().isEmpty())
65 continue;
66
67 // If its our desired IP (e.g. from --listen) return early
68 if (addr == address)
69 return addr.toString();
70 if (firstHostFound.isEmpty())
71 firstHostFound = addr.toString();
72 }
73 }
74 return firstHostFound;
75}
76

Callers

nothing calls this directly

Calls 3

flagsMethod · 0.45
serverAddressMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected