summaryrefslogtreecommitdiffstats
path: root/util/network/hostip.cpp
diff options
context:
space:
mode:
authortrifon <[email protected]>2022-02-10 16:50:51 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:50:51 +0300
commitdd6b55b11723e4bb5b0cf7bffc0e45f15e2e46d3 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/network/hostip.cpp
parente3135d62bbcf321d86fff8258f5cdc5b2f57bde5 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/network/hostip.cpp')
-rw-r--r--util/network/hostip.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/util/network/hostip.cpp b/util/network/hostip.cpp
index e217fa62dd6..cb8d43bf903 100644
--- a/util/network/hostip.cpp
+++ b/util/network/hostip.cpp
@@ -3,12 +3,12 @@
#include <util/system/defaults.h>
#include <util/system/byteorder.h>
-
+
#if defined(_unix_) || defined(_cygwin_)
#include <netdb.h>
-#endif
-
-#if !defined(BIND_LIB)
+#endif
+
+#if !defined(BIND_LIB)
#if !defined(__FreeBSD__) && !defined(_win32_) && !defined(_cygwin_)
#define AGENT_USE_GETADDRINFO
#endif
@@ -16,13 +16,13 @@
#if defined(__FreeBSD__)
#define AGENT_USE_GETADDRINFO
#endif
-#endif
-
+#endif
+
int NResolver::GetHostIP(const char* hostname, ui32* ip, size_t* slots) {
size_t i = 0;
size_t ipsFound = 0;
-
-#ifdef AGENT_USE_GETADDRINFO
+
+#ifdef AGENT_USE_GETADDRINFO
int ret = 0;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
@@ -50,7 +50,7 @@ int NResolver::GetHostIP(const char* hostname, ui32* ip, size_t* slots) {
if (ret) {
return ret;
}
-#else
+#else
hostent* hostent = gethostbyname(hostname);
if (!hostent)
@@ -62,15 +62,15 @@ int NResolver::GetHostIP(const char* hostname, ui32* ip, size_t* slots) {
char** cur = hostent->h_addr_list;
for (i = 0; i < *slots && *cur; i++, cur++, ipsFound++)
ip[i] = *(ui32*)*cur;
-#endif
+#endif
for (i = 0; i < ipsFound; i++) {
ip[i] = InetToHost(ip[i]);
}
*slots = ipsFound;
-
+
return 0;
}
-
+
int NResolver::GetDnsError() {
return h_errno;
}