diff options
author | trifon <trifon@yandex-team.ru> | 2022-02-10 16:50:51 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:51 +0300 |
commit | dd6b55b11723e4bb5b0cf7bffc0e45f15e2e46d3 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/network | |
parent | e3135d62bbcf321d86fff8258f5cdc5b2f57bde5 (diff) | |
download | ydb-dd6b55b11723e4bb5b0cf7bffc0e45f15e2e46d3.tar.gz |
Restoring authorship annotation for <trifon@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/network')
-rw-r--r-- | util/network/hostip.cpp | 24 | ||||
-rw-r--r-- | util/network/hostip.h | 4 |
2 files changed, 14 insertions, 14 deletions
diff --git a/util/network/hostip.cpp b/util/network/hostip.cpp index e217fa62dd..cb8d43bf90 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; } diff --git a/util/network/hostip.h b/util/network/hostip.h index 9673bb99c3..cf63e4846a 100644 --- a/util/network/hostip.h +++ b/util/network/hostip.h @@ -1,7 +1,7 @@ #pragma once - + #include <util/system/defaults.h> - + namespace NResolver { // resolve hostname and fills up to *slots slots in ip array; // actual number of slots filled is returned in *slots; |