From 984590e9d9d7c0f912885d93ae78be402ae7b4f4 Mon Sep 17 00:00:00 2001
From: and42 <and42@yandex-team.ru>
Date: Thu, 10 Feb 2022 16:47:12 +0300
Subject: Restoring authorship annotation for <and42@yandex-team.ru>. Commit 2
 of 2.

---
 library/cpp/coroutine/engine/sockpool.cpp | 104 +++++++++++++++---------------
 library/cpp/coroutine/engine/sockpool.h   |  12 ++--
 library/cpp/coroutine/engine/ya.make      |   2 +-
 3 files changed, 59 insertions(+), 59 deletions(-)

(limited to 'library/cpp/coroutine/engine')

diff --git a/library/cpp/coroutine/engine/sockpool.cpp b/library/cpp/coroutine/engine/sockpool.cpp
index 01f8c35a4d..b9482e780f 100644
--- a/library/cpp/coroutine/engine/sockpool.cpp
+++ b/library/cpp/coroutine/engine/sockpool.cpp
@@ -1,58 +1,58 @@
-#include "sockpool.h" 
- 
-void SetCommonSockOpts(SOCKET sock, const struct sockaddr* sa) { 
-    SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, 1); 
- 
-    if (!sa || sa->sa_family == AF_INET) { 
-        sockaddr_in s_in; 
-        s_in.sin_family = AF_INET; 
-        s_in.sin_addr.s_addr = INADDR_ANY; 
-        s_in.sin_port = 0; 
- 
-        if (bind(sock, (struct sockaddr*)&s_in, sizeof(s_in)) == -1) { 
-            warn("bind"); 
-        } 
-    } else if (sa->sa_family == AF_INET6) { 
+#include "sockpool.h"
+
+void SetCommonSockOpts(SOCKET sock, const struct sockaddr* sa) {
+    SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, 1);
+
+    if (!sa || sa->sa_family == AF_INET) {
+        sockaddr_in s_in;
+        s_in.sin_family = AF_INET;
+        s_in.sin_addr.s_addr = INADDR_ANY;
+        s_in.sin_port = 0;
+
+        if (bind(sock, (struct sockaddr*)&s_in, sizeof(s_in)) == -1) {
+            warn("bind");
+        }
+    } else if (sa->sa_family == AF_INET6) {
         sockaddr_in6 s_in6(*(const sockaddr_in6*)sa);
-        Zero(s_in6.sin6_addr); 
-        s_in6.sin6_port = 0; 
- 
-        if (bind(sock, (const struct sockaddr*)&s_in6, sizeof s_in6) == -1) { 
-            warn("bind6"); 
-        } 
-    } else { 
+        Zero(s_in6.sin6_addr);
+        s_in6.sin6_port = 0;
+
+        if (bind(sock, (const struct sockaddr*)&s_in6, sizeof s_in6) == -1) {
+            warn("bind6");
+        }
+    } else {
         Y_ASSERT(0);
-    } 
- 
-    SetNoDelay(sock, true); 
-} 
- 
-TPooledSocket TSocketPool::AllocateMore(TConnectData* conn) { 
-    TCont* cont = conn->Cont; 
- 
-    while (true) { 
+    }
+
+    SetNoDelay(sock, true);
+}
+
+TPooledSocket TSocketPool::AllocateMore(TConnectData* conn) {
+    TCont* cont = conn->Cont;
+
+    while (true) {
         TSocketHolder s(NCoro::Socket(Addr_->Addr()->sa_family, SOCK_STREAM, 0));
- 
-        if (s == INVALID_SOCKET) { 
+
+        if (s == INVALID_SOCKET) {
             ythrow TSystemError(errno) << TStringBuf("can not create socket");
-        } 
- 
-        SetCommonSockOpts(s, Addr_->Addr()); 
-        SetZeroLinger(s); 
- 
+        }
+
+        SetCommonSockOpts(s, Addr_->Addr());
+        SetZeroLinger(s);
+
         const int ret = NCoro::ConnectD(cont, s, Addr_->Addr(), Addr_->Len(), conn->DeadLine);
- 
-        if (ret == EINTR) { 
-            continue; 
-        } else if (ret) { 
+
+        if (ret == EINTR) {
+            continue;
+        } else if (ret) {
             ythrow TSystemError(ret) << TStringBuf("can not connect(") << cont->Name() << ')';
-        } 
- 
-        THolder<TPooledSocket::TImpl> res(new TPooledSocket::TImpl(s, this)); 
-        s.Release(); 
- 
-        if (res->IsOpen()) { 
-            return res.Release(); 
-        } 
-    } 
-} 
+        }
+
+        THolder<TPooledSocket::TImpl> res(new TPooledSocket::TImpl(s, this));
+        s.Release();
+
+        if (res->IsOpen()) {
+            return res.Release();
+        }
+    }
+}
diff --git a/library/cpp/coroutine/engine/sockpool.h b/library/cpp/coroutine/engine/sockpool.h
index da1f3b3a04..1ebb7e7b38 100644
--- a/library/cpp/coroutine/engine/sockpool.h
+++ b/library/cpp/coroutine/engine/sockpool.h
@@ -1,11 +1,11 @@
 #pragma once
 
-#include "impl.h" 
+#include "impl.h"
 #include "network.h"
 
-#include <util/network/address.h> 
-#include <util/network/socket.h> 
-#include <util/system/mutex.h> 
+#include <util/network/address.h>
+#include <util/network/socket.h>
+#include <util/system/mutex.h>
 
 extern void SetCommonSockOpts(SOCKET sock, const struct sockaddr* sa = nullptr);
 
@@ -143,7 +143,7 @@ class TSocketPool {
 
 public:
     typedef TAtomicSharedPtr<NAddr::IRemoteAddr> TAddrRef;
- 
+
     TSocketPool(int ip, int port)
         : Addr_(new NAddr::TIPv4Addr(TIpAddress((ui32)ip, (ui16)port)))
     {
@@ -153,7 +153,7 @@ public:
         : Addr_(addr)
     {
     }
- 
+
     void EraseStale(const TInstant& maxAge) noexcept {
         TSockets toDelete;
 
diff --git a/library/cpp/coroutine/engine/ya.make b/library/cpp/coroutine/engine/ya.make
index b81b35476e..8c20b9afc3 100644
--- a/library/cpp/coroutine/engine/ya.make
+++ b/library/cpp/coroutine/engine/ya.make
@@ -20,7 +20,7 @@ SRCS(
     iostatus.cpp
     network.cpp
     poller.cpp
-    sockpool.cpp 
+    sockpool.cpp
     stack/stack.cpp
     stack/stack_allocator.cpp
     stack/stack_guards.cpp
-- 
cgit v1.2.3