diff options
author | malets <malets@yandex-team.ru> | 2022-02-10 16:52:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:52:01 +0300 |
commit | 9fb6b07ce98b16ba076a7eaf8d90c335276df153 (patch) | |
tree | ab7fbbf3253d4c0e2793218f09378908beb025fb | |
parent | 4290f1d64573e159d3a12d374b93a837a68c7869 (diff) | |
download | ydb-9fb6b07ce98b16ba076a7eaf8d90c335276df153.tar.gz |
Restoring authorship annotation for <malets@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | util/generic/algorithm.h | 64 | ||||
-rw-r--r-- | util/network/socket.cpp | 22 | ||||
-rw-r--r-- | util/network/socket.h | 14 |
3 files changed, 50 insertions, 50 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index 3909d7a270..badfb88993 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -387,51 +387,51 @@ template <class TI, class TO, class TP> static inline TO RemoveCopyIf(TI f, TI l, TO t, TP p) { return std::remove_copy_if(f, l, t, p); } - + template <class TI, class TO> static inline TO ReverseCopy(TI f, TI l, TO t) { return std::reverse_copy(f, l, t); } -template <class TI1, class TI2, class TO> -static inline TO SetUnion(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { +template <class TI1, class TI2, class TO> +static inline TO SetUnion(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { return std::set_union(f1, l1, f2, l2, p); -} - -template <class TI1, class TI2, class TO, class TC> -static inline TO SetUnion(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { +} + +template <class TI1, class TI2, class TO, class TC> +static inline TO SetUnion(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { return std::set_union(f1, l1, f2, l2, p, c); -} - -template <class TI1, class TI2, class TO> -static inline TO SetDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { +} + +template <class TI1, class TI2, class TO> +static inline TO SetDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { return std::set_difference(f1, l1, f2, l2, p); -} - -template <class TI1, class TI2, class TO, class TC> -static inline TO SetDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { +} + +template <class TI1, class TI2, class TO, class TC> +static inline TO SetDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { return std::set_difference(f1, l1, f2, l2, p, c); -} - -template <class TI1, class TI2, class TO> -static inline TO SetSymmetricDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { +} + +template <class TI1, class TI2, class TO> +static inline TO SetSymmetricDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { return std::set_symmetric_difference(f1, l1, f2, l2, p); -} - -template <class TI1, class TI2, class TO, class TC> -static inline TO SetSymmetricDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { +} + +template <class TI1, class TI2, class TO, class TC> +static inline TO SetSymmetricDifference(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { return std::set_symmetric_difference(f1, l1, f2, l2, p, c); -} - -template <class TI1, class TI2, class TO> -static inline TO SetIntersection(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { +} + +template <class TI1, class TI2, class TO> +static inline TO SetIntersection(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p) { return std::set_intersection(f1, l1, f2, l2, p); -} - -template <class TI1, class TI2, class TO, class TC> -static inline TO SetIntersection(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { +} + +template <class TI1, class TI2, class TO, class TC> +static inline TO SetIntersection(TI1 f1, TI1 l1, TI2 f2, TI2 l2, TO p, TC c) { return std::set_intersection(f1, l1, f2, l2, p, c); -} +} template <class I, class T> static inline void Fill(I f, I l, const T& v) { diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 42e84bd4e8..4f6e804346 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -244,12 +244,12 @@ bool GetRemoteAddr(SOCKET Socket, char* str, socklen_t size) { if (!size) { return false; } - + TOpaqueAddr addr; - + if (getpeername(Socket, addr.MutableAddr(), addr.LenPtr()) != 0) { return false; - } + } try { TMemoryOutput out(str, size - 1); @@ -262,7 +262,7 @@ bool GetRemoteAddr(SOCKET Socket, char* str, socklen_t size) { // ¯\_(ツ)_/¯ } - return false; + return false; } void SetSocketTimeout(SOCKET s, long timeout) { @@ -637,12 +637,12 @@ void Out<TNetworkAddress>(IOutputStream& os, const TNetworkAddress& addr) { os << &*addr.Begin(); } -static inline const struct addrinfo* Iterate(const struct addrinfo* addr, const struct addrinfo* addr0, const int sockerr) { +static inline const struct addrinfo* Iterate(const struct addrinfo* addr, const struct addrinfo* addr0, const int sockerr) { if (addr->ai_next) { return addr->ai_next; } - ythrow TSystemError(sockerr) << "can not connect to " << addr0; + ythrow TSystemError(sockerr) << "can not connect to " << addr0; } static inline SOCKET DoConnectImpl(const struct addrinfo* res, const TInstant& deadLine) { @@ -652,7 +652,7 @@ static inline SOCKET DoConnectImpl(const struct addrinfo* res, const TInstant& d TSocketHolder s(socket(res->ai_family, res->ai_socktype, res->ai_protocol)); if (s.Closed()) { - res = Iterate(res, addr0, LastSystemError()); + res = Iterate(res, addr0, LastSystemError()); continue; } @@ -660,7 +660,7 @@ static inline SOCKET DoConnectImpl(const struct addrinfo* res, const TInstant& d SetNonBlock(s, true); if (connect(s, res->ai_addr, (int)res->ai_addrlen)) { - int err = LastSystemError(); + int err = LastSystemError(); if (err == EINPROGRESS || err == EAGAIN || err == EWOULDBLOCK) { /* @@ -680,14 +680,14 @@ static inline SOCKET DoConnectImpl(const struct addrinfo* res, const TInstant& d ythrow TSystemError(-(int)n) << "can not connect"; } - CheckedGetSockOpt(s, SOL_SOCKET, SO_ERROR, err, "socket error"); - + CheckedGetSockOpt(s, SOL_SOCKET, SO_ERROR, err, "socket error"); + if (!err) { return s.Release(); } } - res = Iterate(res, addr0, err); + res = Iterate(res, addr0, err); continue; } diff --git a/util/network/socket.h b/util/network/socket.h index e6e65cdb42..40c8648b40 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -77,13 +77,13 @@ static inline void CheckedSetSockOpt(SOCKET s, int level, int optname, T opt, co } } -template <class T> -static inline void CheckedGetSockOpt(SOCKET s, int level, int optname, T& opt, const char* err) { - if (GetSockOpt<T>(s, level, optname, opt)) { - ythrow TSystemError() << "getsockopt() failed for " << err; - } -} - +template <class T> +static inline void CheckedGetSockOpt(SOCKET s, int level, int optname, T& opt, const char* err) { + if (GetSockOpt<T>(s, level, optname, opt)) { + ythrow TSystemError() << "getsockopt() failed for " << err; + } +} + static inline void FixIPv6ListenSocket(SOCKET s) { #if defined(IPV6_V6ONLY) SetSockOpt(s, IPPROTO_IPV6, IPV6_V6ONLY, 1); |