aboutsummaryrefslogtreecommitdiffstats
path: root/util/network/socket.cpp
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
commit6170310e8721e225f64ddabf7a7358253d7a1249 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /util/network/socket.cpp
parentcde218e65dfef5ce03a48d641fd8f7913cf17b2d (diff)
downloadydb-6170310e8721e225f64ddabf7a7358253d7a1249.tar.gz
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 2 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 1b7445d612..4f6e804346 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");