Update network_util.cpp
Adjust the indentation.
This commit is contained in:
@@ -99,24 +99,25 @@ bool FindLocalIP(const struct sockaddr_in &client_addr, uint32_t &local_ip) {
|
|||||||
|
|
||||||
IP_ADAPTER_INFO *pAdapter = reinterpret_cast<IP_ADAPTER_INFO *>(pAdapterInfo.get());
|
IP_ADAPTER_INFO *pAdapter = reinterpret_cast<IP_ADAPTER_INFO *>(pAdapterInfo.get());
|
||||||
if (NO_ERROR == dlRetVal && pAdapter != NULL) {
|
if (NO_ERROR == dlRetVal && pAdapter != NULL) {
|
||||||
while (pAdapter != NULL) {
|
while (pAdapter != NULL) {
|
||||||
if (GetAdapterState(pAdapter)) {
|
if (GetAdapterState(pAdapter)) {
|
||||||
std::string str_ip = pAdapter->IpAddressList.IpAddress.String;
|
std::string str_ip = pAdapter->IpAddressList.IpAddress.String;
|
||||||
std::string str_mask = pAdapter->IpAddressList.IpMask.String;
|
std::string str_mask = pAdapter->IpAddressList.IpMask.String;
|
||||||
ULONG host_ip = inet_addr(const_cast<char *>(str_ip.c_str()));
|
ULONG host_ip = inet_addr(const_cast<char *>(str_ip.c_str()));
|
||||||
ULONG host_mask = inet_addr(const_cast<char *>(str_mask.c_str()));
|
ULONG host_mask = inet_addr(const_cast<char *>(str_mask.c_str()));
|
||||||
|
|
||||||
if ((host_ip & host_mask) ==
|
if ((host_ip & host_mask) ==
|
||||||
(client_addr.sin_addr.S_un.S_addr & host_mask)) {
|
(client_addr.sin_addr.S_un.S_addr & host_mask)) {
|
||||||
local_ip = host_ip;
|
local_ip = host_ip;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pAdapter = pAdapter->Next;
|
pAdapter = pAdapter->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -152,4 +153,4 @@ bool FindLocalIP(const struct sockaddr_in &client_addr, uint32_t &local_ip) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace livox
|
} // namespace livox
|
||||||
|
|||||||
Reference in New Issue
Block a user