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 | |
parent | e3135d62bbcf321d86fff8258f5cdc5b2f57bde5 (diff) | |
download | ydb-dd6b55b11723e4bb5b0cf7bffc0e45f15e2e46d3.tar.gz |
Restoring authorship annotation for <trifon@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/datetime/base.h | 6 | ||||
-rw-r--r-- | util/network/hostip.cpp | 24 | ||||
-rw-r--r-- | util/network/hostip.h | 4 |
3 files changed, 17 insertions, 17 deletions
diff --git a/util/datetime/base.h b/util/datetime/base.h index 7feff12114..5e902b8f63 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -58,8 +58,8 @@ size_t FormatDate8601(char* buf, size_t len, time_t when); inline void sprint_date8601(char* buf, time_t when) { buf[FormatDate8601(buf, 64, when)] = 0; -} - +} + bool ParseISO8601DateTimeDeprecated(const char* date, time_t& utcTime); bool ParseISO8601DateTimeDeprecated(const char* date, size_t dateLen, time_t& utcTime); bool ParseRFC822DateTimeDeprecated(const char* date, time_t& utcTime); @@ -77,7 +77,7 @@ bool ParseHTTPDateTime(const char* date, time_t& utcTime); bool ParseHTTPDateTime(const char* date, size_t dateLen, time_t& utcTime); bool ParseX509ValidityDateTime(const char* date, time_t& utcTime); bool ParseX509ValidityDateTime(const char* date, size_t dateLen, time_t& utcTime); - + constexpr long TVdiff(timeval r1, timeval r2) { return (1000000 * (r2.tv_sec - r1.tv_sec) + (r2.tv_usec - r1.tv_usec)); } 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; |