aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorwd28 <wd28@yandex-team.ru>2022-02-10 16:49:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:40 +0300
commit1b7466cb957659079ebebbb5d76e64e51f3306f0 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library
parent23df4007b6ffbbdb0b25a214dded0c60538fb558 (diff)
downloadydb-1b7466cb957659079ebebbb5d76e64e51f3306f0.tar.gz
Restoring authorship annotation for <wd28@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library')
-rw-r--r--library/cpp/cache/thread_safe_cache.h14
-rw-r--r--library/cpp/cache/ut/cache_ut.cpp4
-rw-r--r--library/cpp/http/server/http.cpp76
-rw-r--r--library/cpp/http/server/http.h2
4 files changed, 48 insertions, 48 deletions
diff --git a/library/cpp/cache/thread_safe_cache.h b/library/cpp/cache/thread_safe_cache.h
index baa39ec68f..71e1442717 100644
--- a/library/cpp/cache/thread_safe_cache.h
+++ b/library/cpp/cache/thread_safe_cache.h
@@ -15,8 +15,8 @@ namespace NPrivate {
template <class Key, class Value, template <class, class> class List, EGettersPromotionPolicy GettersPromotionPolicy, class... TArgs>
class TThreadSafeCache {
public:
- using TPtr = TAtomicSharedPtr<Value>;
-
+ using TPtr = TAtomicSharedPtr<Value>;
+
class ICallbacks {
public:
using TKey = Key;
@@ -30,9 +30,9 @@ namespace NPrivate {
};
public:
- TThreadSafeCache(const ICallbacks& callbacks, size_t maxSize = Max<size_t>())
+ TThreadSafeCache(const ICallbacks& callbacks, size_t maxSize = Max<size_t>())
: Callbacks(callbacks)
- , Cache(maxSize)
+ , Cache(maxSize)
{
}
@@ -49,7 +49,7 @@ namespace NPrivate {
Cache.Update(key, value);
}
- const TPtr Get(TArgs... args) const {
+ const TPtr Get(TArgs... args) const {
return GetValue<true>(args...);
}
@@ -82,7 +82,7 @@ namespace NPrivate {
}
template <class TCallbacks>
- static const TPtr Get(TArgs... args) {
+ static const TPtr Get(TArgs... args) {
return TThreadSafeCacheSingleton<TCallbacks>::Get(args...);
}
@@ -140,7 +140,7 @@ namespace NPrivate {
template <class TCallbacks>
class TThreadSafeCacheSingleton {
public:
- static const TPtr Get(TArgs... args) {
+ static const TPtr Get(TArgs... args) {
return Singleton<TThreadSafeCacheSingleton>()->Cache.Get(args...);
}
diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp
index fa7fa8a27b..329872cfde 100644
--- a/library/cpp/cache/ut/cache_ut.cpp
+++ b/library/cpp/cache/ut/cache_ut.cpp
@@ -377,8 +377,8 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) {
Y_UNIT_TEST(SimpleTest) {
for (ui32 i = 0; i < Y_ARRAY_SIZE(VALS); ++i) {
- const TString data = *TCache::Get<TCallbacks>(i);
- UNIT_ASSERT(data == VALS[i]);
+ const TString data = *TCache::Get<TCallbacks>(i);
+ UNIT_ASSERT(data == VALS[i]);
}
}
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index 5aaf48db07..128583bdd7 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -326,17 +326,17 @@ public:
ErrorCode = 0;
TIntrusiveListWithAutoDelete<TListenSocket, TDelete> Reqs;
- std::function<void(TSocket)> callback = [&](TSocket socket) {
- THolder<TListenSocket> ls(new TListenSocket(socket, this));
- Poller->WaitRead(socket, static_cast<IPollAble*>(ls.Get()));
- Reqs.PushBack(ls.Release());
- };
+ std::function<void(TSocket)> callback = [&](TSocket socket) {
+ THolder<TListenSocket> ls(new TListenSocket(socket, this));
+ Poller->WaitRead(socket, static_cast<IPollAble*>(ls.Get()));
+ Reqs.PushBack(ls.Release());
+ };
bool addressesBound = TryToBindAddresses(Options_, &callback);
if (!addressesBound) {
SaveErrorCode();
- ListenStartEvent.Signal();
+ ListenStartEvent.Signal();
- return;
+ return;
}
Requests->Start(Options_.nThreads, Options_.MaxQueueSize);
@@ -795,49 +795,49 @@ bool TRequestReplier::Reply(void* threadSpecificResource) {
return DoReply(params);
}
-
+
bool TryToBindAddresses(const THttpServerOptions& options, const std::function<void(TSocket)>* callbackOnBoundAddress) {
- THttpServerOptions::TBindAddresses addrs;
+ THttpServerOptions::TBindAddresses addrs;
try {
options.BindAddresses(addrs);
} catch (const std::exception&) {
return false;
}
-
- for (const auto& na : addrs) {
- for (TNetworkAddress::TIterator ai = na.Begin(); ai != na.End(); ++ai) {
- NAddr::TAddrInfo addr(&*ai);
-
- TSocket socket(::socket(addr.Addr()->sa_family, SOCK_STREAM, 0));
-
- if (socket == INVALID_SOCKET) {
+
+ for (const auto& na : addrs) {
+ for (TNetworkAddress::TIterator ai = na.Begin(); ai != na.End(); ++ai) {
+ NAddr::TAddrInfo addr(&*ai);
+
+ TSocket socket(::socket(addr.Addr()->sa_family, SOCK_STREAM, 0));
+
+ if (socket == INVALID_SOCKET) {
return false;
- }
-
- FixIPv6ListenSocket(socket);
-
+ }
+
+ FixIPv6ListenSocket(socket);
+
if (options.ReuseAddress) {
int yes = 1;
::setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&yes, sizeof(yes));
}
-
- if (options.ReusePort) {
- SetReusePort(socket, true);
- }
-
- if (::bind(socket, addr.Addr(), addr.Len()) == SOCKET_ERROR) {
+
+ if (options.ReusePort) {
+ SetReusePort(socket, true);
+ }
+
+ if (::bind(socket, addr.Addr(), addr.Len()) == SOCKET_ERROR) {
return false;
- }
-
- if (::listen(socket, options.ListenBacklog) == SOCKET_ERROR) {
+ }
+
+ if (::listen(socket, options.ListenBacklog) == SOCKET_ERROR) {
return false;
- }
-
+ }
+
if (callbackOnBoundAddress != nullptr) {
- (*callbackOnBoundAddress)(socket);
- }
- }
- }
-
+ (*callbackOnBoundAddress)(socket);
+ }
+ }
+ }
+
return true;
-}
+}
diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h
index 6a49c6649e..b292d38f27 100644
--- a/library/cpp/http/server/http.h
+++ b/library/cpp/http/server/http.h
@@ -172,5 +172,5 @@ private:
using TClientRequest::Input;
using TClientRequest::Output;
};
-
+
bool TryToBindAddresses(const THttpServerOptions& options, const std::function<void(TSocket)>* callbackOnBoundAddress = nullptr);