diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/dns | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/dns')
-rw-r--r-- | library/cpp/dns/cache.cpp | 14 | ||||
-rw-r--r-- | library/cpp/dns/cache.h | 8 | ||||
-rw-r--r-- | library/cpp/dns/thread.cpp | 16 | ||||
-rw-r--r-- | library/cpp/dns/thread.h | 4 |
4 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/dns/cache.cpp b/library/cpp/dns/cache.cpp index 05c14e82fc..a1031fed02 100644 --- a/library/cpp/dns/cache.cpp +++ b/library/cpp/dns/cache.cpp @@ -80,7 +80,7 @@ namespace { } } - void AddAlias(const TString& host, const TString& alias) noexcept { + void AddAlias(const TString& host, const TString& alias) noexcept { TWriteGuard guard(LA_); A_[host] = alias; @@ -92,8 +92,8 @@ namespace { private: inline TResolvedHostPtr ResolveA(const TResolveTask& rt) { - TString originalHost(rt.Info.Host); - TString host(originalHost); + TString originalHost(rt.Info.Host); + TString host(originalHost); //3. replace host to alias, if exist if (A_.size()) { @@ -129,10 +129,10 @@ namespace { return new TResolvedHost(originalHost, *na); } - typedef THashMap<TResolveInfo, TResolvedHostPtr, THashResolveInfo, TCompareResolveInfo> TCache; + typedef THashMap<TResolveInfo, TResolvedHostPtr, THashResolveInfo, TCompareResolveInfo> TCache; TCache C_; TRWMutex L_; - typedef THashMap<TString, TString> TAliases; + typedef THashMap<TString, TString> TAliases; TAliases A_; TRWMutex LA_; }; @@ -162,7 +162,7 @@ namespace { } private: - typedef THashMap<TResolveInfo, const TResolvedHost*, THashResolveInfo, TCompareResolveInfo> TCache; + typedef THashMap<TResolveInfo, const TResolvedHost*, THashResolveInfo, TCompareResolveInfo> TCache; TCache C_; IDns* S_; }; @@ -192,7 +192,7 @@ namespace NDns { return ThrDns()->Resolve(rt); } - void AddHostAlias(const TString& host, const TString& alias) { + void AddHostAlias(const TString& host, const TString& alias) { TGlobalCachedDns::Instance()->AddAlias(host, alias); } } diff --git a/library/cpp/dns/cache.h b/library/cpp/dns/cache.h index eda5dc4070..01c5da298f 100644 --- a/library/cpp/dns/cache.h +++ b/library/cpp/dns/cache.h @@ -2,7 +2,7 @@ #include <util/network/socket.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NDns { struct TResolveInfo { @@ -17,14 +17,14 @@ namespace NDns { }; struct TResolvedHost { - inline TResolvedHost(const TString& host, const TNetworkAddress& addr) noexcept + inline TResolvedHost(const TString& host, const TNetworkAddress& addr) noexcept : Host(host) , Addr(addr) , Id(0) { } - TString Host; //resolved hostname (from TResolveInfo, - before aliasing) + TString Host; //resolved hostname (from TResolveInfo, - before aliasing) TNetworkAddress Addr; size_t Id; //cache record id }; @@ -41,5 +41,5 @@ namespace NDns { const TResolvedHost* CachedThrResolve(const TResolveInfo& ri); //create alias for host, which can be used for static resolving (when alias is ip address) - void AddHostAlias(const TString& host, const TString& alias); + void AddHostAlias(const TString& host, const TString& alias); } diff --git a/library/cpp/dns/thread.cpp b/library/cpp/dns/thread.cpp index 8b27d2d527..a8441d7c90 100644 --- a/library/cpp/dns/thread.cpp +++ b/library/cpp/dns/thread.cpp @@ -14,7 +14,7 @@ using namespace NDns; namespace { class TThreadedResolver: public IThreadFactory::IThreadAble, public TNonCopyable { struct TResolveRequest { - inline TResolveRequest(const TString& host, ui16 port) + inline TResolveRequest(const TString& host, ui16 port) : Host(host) , Port(port) { @@ -36,7 +36,7 @@ namespace { ythrow TNetworkResolutionError(EAI_FAIL) << TStringBuf(": shit happen"); } - inline void Resolve() noexcept { + inline void Resolve() noexcept { try { Result = new TNetworkAddress(Host, Port); } catch (...) { @@ -46,11 +46,11 @@ namespace { Wake(); } - inline void Wake() noexcept { + inline void Wake() noexcept { E.Signal(); } - TString Host; + TString Host; ui16 Port; TManualEvent E; TNetworkAddressPtr Result; @@ -64,7 +64,7 @@ namespace { T_.push_back(SystemThreadFactory()->Run(this)); } - inline ~TThreadedResolver() override { + inline ~TThreadedResolver() override { Schedule(nullptr); for (size_t i = 0; i < T_.size(); ++i) { @@ -86,7 +86,7 @@ namespace { return Singleton<TThreadedResolver>(); } - inline TNetworkAddressPtr Resolve(const TString& host, ui16 port) { + inline TNetworkAddressPtr Resolve(const TString& host, ui16 port) { TResolveRequest rr(host, port); Schedule(&rr); @@ -122,12 +122,12 @@ namespace { TLockFreeQueue<TResolveRequest*> Q_; TSystemEvent E_; typedef TAutoPtr<IThreadFactory::IThread> IThreadRef; - TVector<IThreadRef> T_; + TVector<IThreadRef> T_; }; } namespace NDns { - TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port) { + TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port) { return TThreadedResolver::Instance()->Resolve(host, port); } } diff --git a/library/cpp/dns/thread.h b/library/cpp/dns/thread.h index 06b41d78ce..f831b6bd0b 100644 --- a/library/cpp/dns/thread.h +++ b/library/cpp/dns/thread.h @@ -2,11 +2,11 @@ #include <util/network/socket.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> namespace NDns { typedef TAutoPtr<TNetworkAddress> TNetworkAddressPtr; - TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port); + TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port); } |