aboutsummaryrefslogtreecommitdiffstats
path: root/util/network/socket_ut.cpp
diff options
context:
space:
mode:
authorermolovd <ermolovd@yandex-team.ru>2022-02-10 16:47:53 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:53 +0300
commitb91bcef7c99a119b0846479ef71bfab4beec72ca (patch)
treebe118d54d12a61bc4812ceb0a266a170a2fa3bc9 /util/network/socket_ut.cpp
parentf421873774cf0b71743afbe5f6677861e66601ea (diff)
downloadydb-b91bcef7c99a119b0846479ef71bfab4beec72ca.tar.gz
Restoring authorship annotation for <ermolovd@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/network/socket_ut.cpp')
-rw-r--r--util/network/socket_ut.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp
index 6b20e11f70..5980c7d370 100644
--- a/util/network/socket_ut.cpp
+++ b/util/network/socket_ut.cpp
@@ -1,7 +1,7 @@
#include "socket.h"
-#include "pair.h"
-
+#include "pair.h"
+
#include <library/cpp/testing/unittest/registar.h>
#include <util/string/builder.h>
@@ -23,7 +23,7 @@ class TSockTest: public TTestBase {
#endif
UNIT_TEST(TestNetworkResolutionError);
UNIT_TEST(TestNetworkResolutionErrorMessage);
- UNIT_TEST(TestBrokenPipe);
+ UNIT_TEST(TestBrokenPipe);
UNIT_TEST(TestClose);
UNIT_TEST(TestReusePortAvailCheck);
UNIT_TEST_SUITE_END();
@@ -34,7 +34,7 @@ public:
void TestConnectionRefused();
void TestNetworkResolutionError();
void TestNetworkResolutionErrorMessage();
- void TestBrokenPipe();
+ void TestBrokenPipe();
void TestClose();
void TestReusePortAvailCheck();
};
@@ -129,43 +129,43 @@ void TSockTest::TestNetworkResolutionErrorMessage() {
}
class TTempEnableSigPipe {
-public:
- TTempEnableSigPipe() {
+public:
+ TTempEnableSigPipe() {
OriginalSigHandler_ = signal(SIGPIPE, SIG_DFL);
Y_VERIFY(OriginalSigHandler_ != SIG_ERR);
- }
-
- ~TTempEnableSigPipe() {
+ }
+
+ ~TTempEnableSigPipe() {
auto ret = signal(SIGPIPE, OriginalSigHandler_);
- Y_VERIFY(ret != SIG_ERR);
- }
-
-private:
+ Y_VERIFY(ret != SIG_ERR);
+ }
+
+private:
void (*OriginalSigHandler_)(int);
-};
-
+};
+
void TSockTest::TestBrokenPipe() {
- TTempEnableSigPipe guard;
-
- SOCKET socks[2];
-
- int ret = SocketPair(socks);
- UNIT_ASSERT_VALUES_EQUAL(ret, 0);
-
- TSocket sender(socks[0]);
- TSocket receiver(socks[1]);
- receiver.ShutDown(SHUT_RDWR);
- int sent = sender.Send("FOO", 3);
- UNIT_ASSERT(sent < 0);
-
- IOutputStream::TPart parts[] = {
- {"foo", 3},
- {"bar", 3},
- };
- sent = sender.SendV(parts, 2);
- UNIT_ASSERT(sent < 0);
-}
-
+ TTempEnableSigPipe guard;
+
+ SOCKET socks[2];
+
+ int ret = SocketPair(socks);
+ UNIT_ASSERT_VALUES_EQUAL(ret, 0);
+
+ TSocket sender(socks[0]);
+ TSocket receiver(socks[1]);
+ receiver.ShutDown(SHUT_RDWR);
+ int sent = sender.Send("FOO", 3);
+ UNIT_ASSERT(sent < 0);
+
+ IOutputStream::TPart parts[] = {
+ {"foo", 3},
+ {"bar", 3},
+ };
+ sent = sender.SendV(parts, 2);
+ UNIT_ASSERT(sent < 0);
+}
+
void TSockTest::TestClose() {
SOCKET socks[2];