diff options
author | feldsherov <feldsherov@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
commit | 077ab504815199e62ffc54daee873cf1d6b64297 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util | |
parent | e73723ec73b27276cd45b9b46b752138a51d669c (diff) | |
download | ydb-077ab504815199e62ffc54daee873cf1d6b64297.tar.gz |
Restoring authorship annotation for <feldsherov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/network/socket.cpp | 16 | ||||
-rw-r--r-- | util/network/socket.h | 4 | ||||
-rw-r--r-- | util/network/socket_ut.cpp | 40 |
3 files changed, 30 insertions, 30 deletions
diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 3c3b303307..4f6e804346 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -601,10 +601,10 @@ public: return Ops_->SendV(Fd_, parts, count); } - inline void Close() { - Fd_.Close(); - } - + inline void Close() { + Fd_.Close(); + } + private: TSocketHolder Fd_; TOps* Ops_; @@ -884,10 +884,10 @@ ssize_t TSocket::SendV(const TPart* parts, size_t count) { return Impl_->SendV(parts, count); } -void TSocket::Close() { - Impl_->Close(); -} - +void TSocket::Close() { + Impl_->Close(); +} + TSocketInput::TSocketInput(const TSocket& s) noexcept : S_(s) { diff --git a/util/network/socket.h b/util/network/socket.h index 44d1097d93..40c8648b40 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -367,8 +367,8 @@ public: ::ShutDown(Fd(), mode); } - void Close(); - + void Close(); + ssize_t Send(const void* data, size_t len); ssize_t Recv(void* buf, size_t len); diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp index d7f6123322..6b20e11f70 100644 --- a/util/network/socket_ut.cpp +++ b/util/network/socket_ut.cpp @@ -24,7 +24,7 @@ class TSockTest: public TTestBase { UNIT_TEST(TestNetworkResolutionError); UNIT_TEST(TestNetworkResolutionErrorMessage); UNIT_TEST(TestBrokenPipe); - UNIT_TEST(TestClose); + UNIT_TEST(TestClose); UNIT_TEST(TestReusePortAvailCheck); UNIT_TEST_SUITE_END(); @@ -35,7 +35,7 @@ public: void TestNetworkResolutionError(); void TestNetworkResolutionErrorMessage(); void TestBrokenPipe(); - void TestClose(); + void TestClose(); void TestReusePortAvailCheck(); }; @@ -166,25 +166,25 @@ void TSockTest::TestBrokenPipe() { UNIT_ASSERT(sent < 0); } -void TSockTest::TestClose() { - SOCKET socks[2]; - +void TSockTest::TestClose() { + SOCKET socks[2]; + UNIT_ASSERT_EQUAL(SocketPair(socks), 0); - TSocket receiver(socks[1]); - - UNIT_ASSERT_EQUAL(static_cast<SOCKET>(receiver), socks[1]); - -#if defined _linux_ - UNIT_ASSERT_GE(fcntl(socks[1], F_GETFD), 0); - receiver.Close(); - UNIT_ASSERT_EQUAL(fcntl(socks[1], F_GETFD), -1); -#else - receiver.Close(); -#endif - - UNIT_ASSERT_EQUAL(static_cast<SOCKET>(receiver), INVALID_SOCKET); -} - + TSocket receiver(socks[1]); + + UNIT_ASSERT_EQUAL(static_cast<SOCKET>(receiver), socks[1]); + +#if defined _linux_ + UNIT_ASSERT_GE(fcntl(socks[1], F_GETFD), 0); + receiver.Close(); + UNIT_ASSERT_EQUAL(fcntl(socks[1], F_GETFD), -1); +#else + receiver.Close(); +#endif + + UNIT_ASSERT_EQUAL(static_cast<SOCKET>(receiver), INVALID_SOCKET); +} + void TSockTest::TestReusePortAvailCheck() { #if defined _linux_ utsname sysInfo; |