aboutsummaryrefslogtreecommitdiffstats
path: root/util/network/socket.cpp
diff options
context:
space:
mode:
authorelantsev <elantsev@yandex-team.ru>2022-02-10 16:49:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:47 +0300
commitafa1b6e6f8b6ee9f8df080d41bcb19b95c25c261 (patch)
tree0be08f6ef31456c320cbd3f575673be79c911588 /util/network/socket.cpp
parent93452ad7de84fbd34e7ba9a906bf10ce1536d722 (diff)
downloadydb-afa1b6e6f8b6ee9f8df080d41bcb19b95c25c261.tar.gz
Restoring authorship annotation for <elantsev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/network/socket.cpp')
-rw-r--r--util/network/socket.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 4f6e804346..8a397344c1 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -448,48 +448,48 @@ bool HasLocalAddress(SOCKET socket) {
return IsSame(localAddr, remoteAddr);
}
-namespace {
-#if defined(_linux_)
+namespace {
+#if defined(_linux_)
#if !defined(TCP_FASTOPEN)
#define TCP_FASTOPEN 23
#endif
-#endif
-
-#if defined(TCP_FASTOPEN)
- struct TTcpFastOpenFeature {
- inline TTcpFastOpenFeature()
- : HasFastOpen_(false)
- {
- TSocketHolder tmp(socket(AF_INET, SOCK_STREAM, 0));
- int val = 1;
- int ret = SetSockOpt(tmp, IPPROTO_TCP, TCP_FASTOPEN, val);
- HasFastOpen_ = (ret == 0);
- }
-
- inline void SetFastOpen(SOCKET s, int qlen) const {
- if (HasFastOpen_) {
- CheckedSetSockOpt(s, IPPROTO_TCP, TCP_FASTOPEN, qlen, "setting TCP_FASTOPEN");
- }
- }
-
- static inline const TTcpFastOpenFeature* Instance() noexcept {
- return Singleton<TTcpFastOpenFeature>();
- }
-
- bool HasFastOpen_;
- };
-#endif
-}
-
-void SetTcpFastOpen(SOCKET s, int qlen) {
-#if defined(TCP_FASTOPEN)
- TTcpFastOpenFeature::Instance()->SetFastOpen(s, qlen);
-#else
+#endif
+
+#if defined(TCP_FASTOPEN)
+ struct TTcpFastOpenFeature {
+ inline TTcpFastOpenFeature()
+ : HasFastOpen_(false)
+ {
+ TSocketHolder tmp(socket(AF_INET, SOCK_STREAM, 0));
+ int val = 1;
+ int ret = SetSockOpt(tmp, IPPROTO_TCP, TCP_FASTOPEN, val);
+ HasFastOpen_ = (ret == 0);
+ }
+
+ inline void SetFastOpen(SOCKET s, int qlen) const {
+ if (HasFastOpen_) {
+ CheckedSetSockOpt(s, IPPROTO_TCP, TCP_FASTOPEN, qlen, "setting TCP_FASTOPEN");
+ }
+ }
+
+ static inline const TTcpFastOpenFeature* Instance() noexcept {
+ return Singleton<TTcpFastOpenFeature>();
+ }
+
+ bool HasFastOpen_;
+ };
+#endif
+}
+
+void SetTcpFastOpen(SOCKET s, int qlen) {
+#if defined(TCP_FASTOPEN)
+ TTcpFastOpenFeature::Instance()->SetFastOpen(s, qlen);
+#else
Y_UNUSED(s);
Y_UNUSED(qlen);
-#endif
-}
-
+#endif
+}
+
static bool IsBlocked(int lasterr) noexcept {
return lasterr == EAGAIN || lasterr == EWOULDBLOCK;
}
@@ -953,7 +953,7 @@ namespace {
insert("localhost.localdomain");
insert("localhost6");
insert("localhost6.localdomain6");
- insert("::1");
+ insert("::1");
}
inline bool IsLocalName(const char* name) const noexcept {