aboutsummaryrefslogtreecommitdiffstats
path: root/util/network
diff options
context:
space:
mode:
authoraosipenko <aosipenko@yandex-team.ru>2022-02-10 16:48:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:08 +0300
commit69e3c43df1c96bc2ac8946bf4dfb1f5fc438ff7f (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /util/network
parent948fd24d47d4b3b7815aaef1686aea00ef3f4288 (diff)
downloadydb-69e3c43df1c96bc2ac8946bf4dfb1f5fc438ff7f.tar.gz
Restoring authorship annotation for <aosipenko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/network')
-rw-r--r--util/network/endpoint_ut.cpp8
-rw-r--r--util/network/socket.cpp14
-rw-r--r--util/network/socket.h4
-rw-r--r--util/network/socket_ut.cpp68
4 files changed, 47 insertions, 47 deletions
diff --git a/util/network/endpoint_ut.cpp b/util/network/endpoint_ut.cpp
index 69f6365d77..d5e40dd6e1 100644
--- a/util/network/endpoint_ut.cpp
+++ b/util/network/endpoint_ut.cpp
@@ -70,20 +70,20 @@ Y_UNIT_TEST_SUITE(TEndpointTest) {
he.insert(ep1);
he.insert(ep2);
- UNIT_ASSERT_VALUES_EQUAL(3u, he.size());
+ UNIT_ASSERT_VALUES_EQUAL(3u, he.size());
he.insert(ep2_);
- UNIT_ASSERT_VALUES_EQUAL(3u, he.size());
+ UNIT_ASSERT_VALUES_EQUAL(3u, he.size());
he.insert(ep3);
he.insert(ep3_);
- UNIT_ASSERT_VALUES_EQUAL(4u, he.size());
+ UNIT_ASSERT_VALUES_EQUAL(4u, he.size());
he.insert(ep4);
- UNIT_ASSERT_VALUES_EQUAL(5u, he.size());
+ UNIT_ASSERT_VALUES_EQUAL(5u, he.size());
}
Y_UNIT_TEST(TestEqual) {
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 44d04424bf..4f6e804346 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -713,7 +713,7 @@ static inline ssize_t DoSendV(SOCKET fd, const struct iovec* iov, size_t count)
} while (ret == -1 && errno == EINTR);
if (ret < 0) {
- return -LastSystemError();
+ return -LastSystemError();
}
return ret;
@@ -1092,11 +1092,11 @@ struct addrinfo* TNetworkAddress::Info() const noexcept {
TNetworkResolutionError::TNetworkResolutionError(int error) {
const char* errMsg = nullptr;
-#ifdef _win_
+#ifdef _win_
errMsg = LastSystemErrorText(error); // gai_strerror is not thread-safe on Windows
-#else
- errMsg = gai_strerror(error);
-#endif
+#else
+ errMsg = gai_strerror(error);
+#endif
(*this) << errMsg << "(" << error;
#if defined(_unix_)
@@ -1106,8 +1106,8 @@ TNetworkResolutionError::TNetworkResolutionError(int error) {
#endif
(*this) << "): ";
-}
-
+}
+
#if defined(_unix_)
static inline int GetFlags(int fd) {
const int ret = fcntl(fd, F_GETFL);
diff --git a/util/network/socket.h b/util/network/socket.h
index 0e587d2fff..40c8648b40 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -148,8 +148,8 @@ struct addrinfo;
class TNetworkResolutionError: public yexception {
public:
- // @param error error code (EAI_XXX) returned by getaddrinfo or getnameinfo (not errno)
- TNetworkResolutionError(int error);
+ // @param error error code (EAI_XXX) returned by getaddrinfo or getnameinfo (not errno)
+ TNetworkResolutionError(int error);
};
struct TUnixSocketPath {
diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp
index 4a826dc170..6b20e11f70 100644
--- a/util/network/socket_ut.cpp
+++ b/util/network/socket_ut.cpp
@@ -15,18 +15,18 @@
#endif
class TSockTest: public TTestBase {
- UNIT_TEST_SUITE(TSockTest);
+ UNIT_TEST_SUITE(TSockTest);
UNIT_TEST(TestSock);
UNIT_TEST(TestTimeout);
-#ifndef _win_ // Test hangs on Windows
+#ifndef _win_ // Test hangs on Windows
UNIT_TEST_EXCEPTION(TestConnectionRefused, yexception);
-#endif
+#endif
UNIT_TEST(TestNetworkResolutionError);
UNIT_TEST(TestNetworkResolutionErrorMessage);
UNIT_TEST(TestBrokenPipe);
UNIT_TEST(TestClose);
UNIT_TEST(TestReusePortAvailCheck);
- UNIT_TEST_SUITE_END();
+ UNIT_TEST_SUITE_END();
public:
void TestSock();
@@ -53,45 +53,45 @@ void TSockTest::TestSock() {
UNIT_ASSERT(!si.ReadLine().empty());
}
-void TSockTest::TestTimeout() {
- static const int timeout = 1000;
- i64 startTime = millisec();
- try {
- TNetworkAddress addr("localhost", 1313);
- TSocket s(addr, TDuration::MilliSeconds(timeout));
+void TSockTest::TestTimeout() {
+ static const int timeout = 1000;
+ i64 startTime = millisec();
+ try {
+ TNetworkAddress addr("localhost", 1313);
+ TSocket s(addr, TDuration::MilliSeconds(timeout));
} catch (const yexception&) {
- }
- int realTimeout = (int)(millisec() - startTime);
- if (realTimeout > timeout + 2000) {
+ }
+ int realTimeout = (int)(millisec() - startTime);
+ if (realTimeout > timeout + 2000) {
TString err = TStringBuilder() << "Timeout exceeded: " << realTimeout << " ms (expected " << timeout << " ms)";
- UNIT_FAIL(err);
- }
-}
-
-void TSockTest::TestConnectionRefused() {
- TNetworkAddress addr("localhost", 1313);
- TSocket s(addr);
-}
-
-void TSockTest::TestNetworkResolutionError() {
+ UNIT_FAIL(err);
+ }
+}
+
+void TSockTest::TestConnectionRefused() {
+ TNetworkAddress addr("localhost", 1313);
+ TSocket s(addr);
+}
+
+void TSockTest::TestNetworkResolutionError() {
TString errMsg;
- try {
- TNetworkAddress addr("", 0);
+ try {
+ TNetworkAddress addr("", 0);
} catch (const TNetworkResolutionError& e) {
- errMsg = e.what();
- }
-
+ errMsg = e.what();
+ }
+
if (errMsg.empty()) {
- return; // on Windows getaddrinfo("", 0, ...) returns "OK"
+ return; // on Windows getaddrinfo("", 0, ...) returns "OK"
}
-
- int expectedErr = EAI_NONAME;
+
+ int expectedErr = EAI_NONAME;
TString expectedErrMsg = gai_strerror(expectedErr);
if (errMsg.find(expectedErrMsg) == TString::npos) {
UNIT_FAIL("TNetworkResolutionError contains\nInvalid msg: " + errMsg + "\nExpected msg: " + expectedErrMsg + "\n");
- }
-}
-
+ }
+}
+
void TSockTest::TestNetworkResolutionErrorMessage() {
#ifdef _unix_
auto str = [](int code) -> TString {