diff options
author | Arseny Smalyuk <smalukav@gmail.com> | 2022-02-10 16:48:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:05 +0300 |
commit | 5f8a2ce7b1dc3b3e1fae197610f189e7ed1d5723 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/network | |
parent | 12559cd7f2fa0cf54ffb0d961949fea58c0e18cb (diff) | |
download | ydb-5f8a2ce7b1dc3b3e1fae197610f189e7ed1d5723.tar.gz |
Restoring authorship annotation for Arseny Smalyuk <smalukav@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/network')
-rw-r--r-- | util/network/poller.cpp | 8 | ||||
-rw-r--r-- | util/network/poller.h | 2 | ||||
-rw-r--r-- | util/network/poller_ut.cpp | 48 | ||||
-rw-r--r-- | util/network/pollerimpl.h | 28 |
4 files changed, 43 insertions, 43 deletions
diff --git a/util/network/poller.cpp b/util/network/poller.cpp index 19cf23ca6a..7954d0e8b5 100644 --- a/util/network/poller.cpp +++ b/util/network/poller.cpp @@ -53,10 +53,10 @@ void TSocketPoller::WaitReadWrite(SOCKET sock, void* cookie) { Impl_->Set(cookie, sock, CONT_POLL_READ | CONT_POLL_WRITE); } -void TSocketPoller::WaitRdhup(SOCKET sock, void* cookie) { - Impl_->Set(cookie, sock, CONT_POLL_RDHUP); -} - +void TSocketPoller::WaitRdhup(SOCKET sock, void* cookie) { + Impl_->Set(cookie, sock, CONT_POLL_RDHUP); +} + void TSocketPoller::WaitReadOneShot(SOCKET sock, void* cookie) { Impl_->Set(cookie, sock, CONT_POLL_READ | CONT_POLL_ONE_SHOT); } diff --git a/util/network/poller.h b/util/network/poller.h index b1307e3d1d..8dccd73140 100644 --- a/util/network/poller.h +++ b/util/network/poller.h @@ -13,7 +13,7 @@ public: void WaitRead(SOCKET sock, void* cookie); void WaitWrite(SOCKET sock, void* cookie); void WaitReadWrite(SOCKET sock, void* cookie); - void WaitRdhup(SOCKET sock, void* cookie); + void WaitRdhup(SOCKET sock, void* cookie); void WaitReadOneShot(SOCKET sock, void* cookie); void WaitWriteOneShot(SOCKET sock, void* cookie); diff --git a/util/network/poller_ut.cpp b/util/network/poller_ut.cpp index 9324d52c9a..6df0dda8ec 100644 --- a/util/network/poller_ut.cpp +++ b/util/network/poller_ut.cpp @@ -3,7 +3,7 @@ #include "pair.h" #include "poller.h" -#include "pollerimpl.h" +#include "pollerimpl.h" Y_UNIT_TEST_SUITE(TSocketPollerTest) { Y_UNIT_TEST(TestSimple) { @@ -209,28 +209,28 @@ Y_UNIT_TEST_SUITE(TSocketPollerTest) { poller.Unwait(sockets[1]); } } - -#if defined(HAVE_EPOLL_POLLER) - Y_UNIT_TEST(TestRdhup) { - SOCKET sockets[2]; - UNIT_ASSERT(SocketPair(sockets) == 0); - - TSocketHolder s1(sockets[0]); - TSocketHolder s2(sockets[1]); - - char buf[1] = {0}; - UNIT_ASSERT_VALUES_EQUAL(1, send(s1, buf, 1, 0)); - shutdown(s1, SHUT_WR); - + +#if defined(HAVE_EPOLL_POLLER) + Y_UNIT_TEST(TestRdhup) { + SOCKET sockets[2]; + UNIT_ASSERT(SocketPair(sockets) == 0); + + TSocketHolder s1(sockets[0]); + TSocketHolder s2(sockets[1]); + + char buf[1] = {0}; + UNIT_ASSERT_VALUES_EQUAL(1, send(s1, buf, 1, 0)); + shutdown(s1, SHUT_WR); + using TPoller = TGenericPoller<TEpollPoller<TWithoutLocking>>; - TPoller poller; - poller.Set((void*)17, s2, CONT_POLL_RDHUP); - - TPoller::TEvent e; - UNIT_ASSERT_VALUES_EQUAL(poller.WaitD(&e, 1, TDuration::Zero().ToDeadLine()), 1); - UNIT_ASSERT_EQUAL(TPoller::ExtractStatus(&e), 0); - UNIT_ASSERT_EQUAL(TPoller::ExtractFilter(&e), CONT_POLL_RDHUP); - UNIT_ASSERT_EQUAL(TPoller::ExtractEvent(&e), (void*)17); - } -#endif + TPoller poller; + poller.Set((void*)17, s2, CONT_POLL_RDHUP); + + TPoller::TEvent e; + UNIT_ASSERT_VALUES_EQUAL(poller.WaitD(&e, 1, TDuration::Zero().ToDeadLine()), 1); + UNIT_ASSERT_EQUAL(TPoller::ExtractStatus(&e), 0); + UNIT_ASSERT_EQUAL(TPoller::ExtractFilter(&e), CONT_POLL_RDHUP); + UNIT_ASSERT_EQUAL(TPoller::ExtractEvent(&e), (void*)17); + } +#endif } diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h index 25ece42701..e8c7e40fba 100644 --- a/util/network/pollerimpl.h +++ b/util/network/pollerimpl.h @@ -36,7 +36,7 @@ enum EContPoll { CONT_POLL_RDHUP = 4, CONT_POLL_ONE_SHOT = 8, // Disable after first event CONT_POLL_MODIFY = 16, // Modify already added event - CONT_POLL_EDGE_TRIGGERED = 32, // Notify only about new events + CONT_POLL_EDGE_TRIGGERED = 32, // Notify only about new events CONT_POLL_BACKLOG_EMPTY = 64, // Backlog is empty (seen end of request, EAGAIN or truncated read) }; @@ -245,10 +245,10 @@ public: e.events |= EPOLLOUT; } - if (what & CONT_POLL_RDHUP) { - e.events |= EPOLLRDHUP; - } - + if (what & CONT_POLL_RDHUP) { + e.events |= EPOLLRDHUP; + } + e.data.ptr = data; if ((what & CONT_POLL_MODIFY) || epoll_ctl(Fd_, EPOLL_CTL_ADD, fd, &e) == -1) { @@ -297,10 +297,10 @@ public: ret |= CONT_POLL_WRITE; } - if (event->events & EPOLLRDHUP) { - ret |= CONT_POLL_RDHUP; - } - + if (event->events & EPOLLRDHUP) { + ret |= CONT_POLL_RDHUP; + } + return ret; } @@ -495,11 +495,11 @@ public: SOCKET* keysToDeleteEnd = keysToDeleteBegin; #if defined(_msan_enabled_) // msan doesn't handle FD_ZERO and cause false positive BALANCER-1347 - memset(in, 0, sizeof(*in)); - memset(out, 0, sizeof(*out)); - memset(errFds, 0, sizeof(*errFds)); + memset(in, 0, sizeof(*in)); + memset(out, 0, sizeof(*out)); + memset(errFds, 0, sizeof(*errFds)); #endif - + FD_ZERO(in); FD_ZERO(out); FD_ZERO(errFds); @@ -669,7 +669,7 @@ public: static inline int ExtractFilter(const TEvent* event) noexcept { if (TBase::ExtractStatus(event)) { - return CONT_POLL_READ | CONT_POLL_WRITE | CONT_POLL_RDHUP; + return CONT_POLL_READ | CONT_POLL_WRITE | CONT_POLL_RDHUP; } return TBase::ExtractFilterImpl(event); |