aboutsummaryrefslogtreecommitdiffstats
path: root/util/network
diff options
context:
space:
mode:
authorstanly <stanly@yandex-team.ru>2022-02-10 16:46:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:49 +0300
commitcde218e65dfef5ce03a48d641fd8f7913cf17b2d (patch)
treed3349caea4095825a55b5ba24fe758067b29ce6f /util/network
parent9f813499b4ef585cb3c2bb93de93ef003daf4fc4 (diff)
downloadydb-cde218e65dfef5ce03a48d641fd8f7913cf17b2d.tar.gz
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/network')
-rw-r--r--util/network/socket.cpp76
-rw-r--r--util/network/socket.h16
2 files changed, 46 insertions, 46 deletions
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 4f6e804346..1b7445d612 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -368,61 +368,61 @@ size_t GetMaximumTransferUnit(SOCKET /*s*/) {
return 8192;
}
-int GetSocketToS(SOCKET s) {
- TOpaqueAddr addr;
-
+int GetSocketToS(SOCKET s) {
+ TOpaqueAddr addr;
+
if (getsockname(s, addr.MutableAddr(), addr.LenPtr()) < 0) {
ythrow TSystemError() << "getsockname() failed";
- }
-
- return GetSocketToS(s, &addr);
-}
-
-int GetSocketToS(SOCKET s, const IRemoteAddr* addr) {
- int result = 0;
-
- switch (addr->Addr()->sa_family) {
+ }
+
+ return GetSocketToS(s, &addr);
+}
+
+int GetSocketToS(SOCKET s, const IRemoteAddr* addr) {
+ int result = 0;
+
+ switch (addr->Addr()->sa_family) {
case AF_INET:
CheckedGetSockOpt(s, IPPROTO_IP, IP_TOS, result, "tos");
break;
-
+
case AF_INET6:
-#ifdef IPV6_TCLASS
+#ifdef IPV6_TCLASS
CheckedGetSockOpt(s, IPPROTO_IPV6, IPV6_TCLASS, result, "tos");
-#endif
+#endif
break;
- }
-
- return result;
-}
-
-void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos) {
- switch (addr->Addr()->sa_family) {
+ }
+
+ return result;
+}
+
+void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos) {
+ switch (addr->Addr()->sa_family) {
case AF_INET:
CheckedSetSockOpt(s, IPPROTO_IP, IP_TOS, tos, "tos");
return;
-
+
case AF_INET6:
-#ifdef IPV6_TCLASS
+#ifdef IPV6_TCLASS
CheckedSetSockOpt(s, IPPROTO_IPV6, IPV6_TCLASS, tos, "tos");
return;
-#endif
+#endif
break;
- }
-
- ythrow yexception() << "SetSocketToS unsupported for family " << addr->Addr()->sa_family;
-}
-
-void SetSocketToS(SOCKET s, int tos) {
- TOpaqueAddr addr;
-
+ }
+
+ ythrow yexception() << "SetSocketToS unsupported for family " << addr->Addr()->sa_family;
+}
+
+void SetSocketToS(SOCKET s, int tos) {
+ TOpaqueAddr addr;
+
if (getsockname(s, addr.MutableAddr(), addr.LenPtr()) < 0) {
ythrow TSystemError() << "getsockname() failed";
- }
-
- SetSocketToS(s, &addr, tos);
-}
-
+ }
+
+ SetSocketToS(s, &addr, tos);
+}
+
void SetSocketPriority(SOCKET s, int priority) {
#if defined(SO_PRIORITY)
CheckedSetSockOpt(s, SOL_SOCKET, SO_PRIORITY, priority, "priority");
diff --git a/util/network/socket.h b/util/network/socket.h
index 40c8648b40..4c8e045e7b 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -92,10 +92,10 @@ static inline void FixIPv6ListenSocket(SOCKET s) {
#endif
}
-namespace NAddr {
- class IRemoteAddr;
-}
-
+namespace NAddr {
+ class IRemoteAddr;
+}
+
void SetSocketTimeout(SOCKET s, long timeout);
void SetSocketTimeout(SOCKET s, long sec, long msec);
void SetNoDelay(SOCKET s, bool value);
@@ -112,10 +112,10 @@ bool GetRemoteAddr(SOCKET s, char* str, socklen_t size);
size_t GetMaximumSegmentSize(SOCKET s);
size_t GetMaximumTransferUnit(SOCKET s);
void SetDeferAccept(SOCKET s);
-void SetSocketToS(SOCKET s, int tos);
-void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos);
-int GetSocketToS(SOCKET s);
-int GetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr);
+void SetSocketToS(SOCKET s, int tos);
+void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos);
+int GetSocketToS(SOCKET s);
+int GetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr);
void SetSocketPriority(SOCKET s, int priority);
void SetTcpFastOpen(SOCKET s, int qlen);
/**