aboutsummaryrefslogtreecommitdiffstats
path: root/util/network/socket_ut.cpp
diff options
context:
space:
mode:
authorAlexey Salmin <alexey.salmin@gmail.com>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:37 +0300
commit71af077a5dfe7e9f932a508422c2dac81a57ebc0 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/network/socket_ut.cpp
parent3c5b1607b38f637d2f3313791ed25c2e080d2647 (diff)
downloadydb-71af077a5dfe7e9f932a508422c2dac81a57ebc0.tar.gz
Restoring authorship annotation for Alexey Salmin <alexey.salmin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/network/socket_ut.cpp')
-rw-r--r--util/network/socket_ut.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp
index 5406312fe90..6b20e11f70a 100644
--- a/util/network/socket_ut.cpp
+++ b/util/network/socket_ut.cpp
@@ -9,11 +9,11 @@
#include <ctime>
-#ifdef _linux_
+#ifdef _linux_
#include <linux/version.h>
#include <sys/utsname.h>
-#endif
-
+#endif
+
class TSockTest: public TTestBase {
UNIT_TEST_SUITE(TSockTest);
UNIT_TEST(TestSock);
@@ -25,7 +25,7 @@ class TSockTest: public TTestBase {
UNIT_TEST(TestNetworkResolutionErrorMessage);
UNIT_TEST(TestBrokenPipe);
UNIT_TEST(TestClose);
- UNIT_TEST(TestReusePortAvailCheck);
+ UNIT_TEST(TestReusePortAvailCheck);
UNIT_TEST_SUITE_END();
public:
@@ -36,7 +36,7 @@ public:
void TestNetworkResolutionErrorMessage();
void TestBrokenPipe();
void TestClose();
- void TestReusePortAvailCheck();
+ void TestReusePortAvailCheck();
};
UNIT_TEST_SUITE_REGISTRATION(TSockTest);
@@ -186,32 +186,32 @@ void TSockTest::TestClose() {
}
void TSockTest::TestReusePortAvailCheck() {
-#if defined _linux_
- utsname sysInfo;
- Y_VERIFY(!uname(&sysInfo), "Error while call uname: %s", LastSystemErrorText());
- TStringBuf release(sysInfo.release);
- release = release.substr(0, release.find_first_not_of(".0123456789"));
- int v1 = FromString<int>(release.NextTok('.'));
- int v2 = FromString<int>(release.NextTok('.'));
- int v3 = FromString<int>(release.NextTok('.'));
- int linuxVersionCode = KERNEL_VERSION(v1, v2, v3);
- if (linuxVersionCode >= KERNEL_VERSION(3, 9, 1)) {
- // new kernels support SO_REUSEPORT
- UNIT_ASSERT(true == IsReusePortAvailable());
- UNIT_ASSERT(true == IsReusePortAvailable());
- } else {
- // older kernels may or may not support SO_REUSEPORT
- // just check that it doesn't crash or throw
- (void)IsReusePortAvailable();
- (void)IsReusePortAvailable();
- }
-#else
- // check that it doesn't crash or throw
- (void)IsReusePortAvailable();
- (void)IsReusePortAvailable();
-#endif
-}
-
+#if defined _linux_
+ utsname sysInfo;
+ Y_VERIFY(!uname(&sysInfo), "Error while call uname: %s", LastSystemErrorText());
+ TStringBuf release(sysInfo.release);
+ release = release.substr(0, release.find_first_not_of(".0123456789"));
+ int v1 = FromString<int>(release.NextTok('.'));
+ int v2 = FromString<int>(release.NextTok('.'));
+ int v3 = FromString<int>(release.NextTok('.'));
+ int linuxVersionCode = KERNEL_VERSION(v1, v2, v3);
+ if (linuxVersionCode >= KERNEL_VERSION(3, 9, 1)) {
+ // new kernels support SO_REUSEPORT
+ UNIT_ASSERT(true == IsReusePortAvailable());
+ UNIT_ASSERT(true == IsReusePortAvailable());
+ } else {
+ // older kernels may or may not support SO_REUSEPORT
+ // just check that it doesn't crash or throw
+ (void)IsReusePortAvailable();
+ (void)IsReusePortAvailable();
+ }
+#else
+ // check that it doesn't crash or throw
+ (void)IsReusePortAvailable();
+ (void)IsReusePortAvailable();
+#endif
+}
+
class TPollTest: public TTestBase {
UNIT_TEST_SUITE(TPollTest);
UNIT_TEST(TestPollInOut);