aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/dns/thread.cpp
diff options
context:
space:
mode:
authorand42 <and42@yandex-team.ru>2022-02-10 16:47:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:12 +0300
commit4fc9a1a64db469cc94894abfec740aa5c9e9789b (patch)
tree525f0b4c196e68c46ae8411cddc11211ef5670c1 /library/cpp/dns/thread.cpp
parent287d7d8c4ffc811d1e51c756ecfb13b78f4ee62d (diff)
downloadydb-4fc9a1a64db469cc94894abfec740aa5c9e9789b.tar.gz
Restoring authorship annotation for <and42@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/dns/thread.cpp')
-rw-r--r--library/cpp/dns/thread.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/dns/thread.cpp b/library/cpp/dns/thread.cpp
index 8b27d2d527..d091b0f144 100644
--- a/library/cpp/dns/thread.cpp
+++ b/library/cpp/dns/thread.cpp
@@ -1,27 +1,27 @@
-#include "thread.h"
-
+#include "thread.h"
+
#include "magic.h"
-#include <util/network/socket.h>
+#include <util/network/socket.h>
#include <util/thread/factory.h>
-#include <util/thread/lfqueue.h>
-#include <util/system/event.h>
+#include <util/thread/lfqueue.h>
+#include <util/system/event.h>
#include <util/generic/vector.h>
-#include <util/generic/singleton.h>
+#include <util/generic/singleton.h>
-using namespace NDns;
+using namespace NDns;
namespace {
class TThreadedResolver: public IThreadFactory::IThreadAble, public TNonCopyable {
struct TResolveRequest {
inline TResolveRequest(const TString& host, ui16 port)
- : Host(host)
- , Port(port)
+ : Host(host)
+ , Port(port)
{
}
- inline TNetworkAddressPtr Wait() {
- E.Wait();
+ inline TNetworkAddressPtr Wait() {
+ E.Wait();
if (!Error) {
if (!Result) {
@@ -38,7 +38,7 @@ namespace {
inline void Resolve() noexcept {
try {
- Result = new TNetworkAddress(Host, Port);
+ Result = new TNetworkAddress(Host, Port);
} catch (...) {
Error = SaveError();
}
@@ -47,20 +47,20 @@ namespace {
}
inline void Wake() noexcept {
- E.Signal();
+ E.Signal();
}
TString Host;
- ui16 Port;
+ ui16 Port;
TManualEvent E;
- TNetworkAddressPtr Result;
+ TNetworkAddressPtr Result;
IErrorRef Error;
};
public:
- inline TThreadedResolver()
+ inline TThreadedResolver()
: E_(TSystemEvent::rAuto)
- {
+ {
T_.push_back(SystemThreadFactory()->Run(this));
}
@@ -87,7 +87,7 @@ namespace {
}
inline TNetworkAddressPtr Resolve(const TString& host, ui16 port) {
- TResolveRequest rr(host, port);
+ TResolveRequest rr(host, port);
Schedule(&rr);
@@ -124,10 +124,10 @@ namespace {
typedef TAutoPtr<IThreadFactory::IThread> IThreadRef;
TVector<IThreadRef> T_;
};
-}
+}
-namespace NDns {
+namespace NDns {
TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port) {
- return TThreadedResolver::Instance()->Resolve(host, port);
+ return TThreadedResolver::Instance()->Resolve(host, port);
}
}