Commit 85525f39 authored by Orvid King's avatar Orvid King Committed by Facebook Github Bot

Remove the fd overload of EventHandler::EventHandler

Summary: Things have been ported, time to remove the fd version.

Reviewed By: yfeldblum

Differential Revision: D14703143

fbshipit-source-id: 13498d5a4c20d19c30c0d0fe942c5d62bb99aa08
parent a96c8c4f
...@@ -26,7 +26,7 @@ TimerFD::TimerFD(folly::EventBase* eventBase) ...@@ -26,7 +26,7 @@ TimerFD::TimerFD(folly::EventBase* eventBase)
: TimerFD(eventBase, createTimerFd()) {} : TimerFD(eventBase, createTimerFd()) {}
TimerFD::TimerFD(folly::EventBase* eventBase, int fd) TimerFD::TimerFD(folly::EventBase* eventBase, int fd)
: folly::EventHandler(eventBase, fd), fd_(fd) { : folly::EventHandler(eventBase, NetworkSocket::fromFd(fd)), fd_(fd) {
if (fd_ > 0) { if (fd_ > 0) {
registerHandler(folly::EventHandler::READ | folly::EventHandler::PERSIST); registerHandler(folly::EventHandler::READ | folly::EventHandler::PERSIST);
} }
......
...@@ -61,8 +61,6 @@ class EventHandler { ...@@ -61,8 +61,6 @@ class EventHandler {
* descriptor must be set separately using initHandler() or * descriptor must be set separately using initHandler() or
* changeHandlerFD() before the handler can be registered. * changeHandlerFD() before the handler can be registered.
*/ */
explicit EventHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, NetworkSocket::fromFd(fd)) {}
explicit EventHandler( explicit EventHandler(
EventBase* eventBase = nullptr, EventBase* eventBase = nullptr,
NetworkSocket fd = NetworkSocket()); NetworkSocket fd = NetworkSocket());
......
...@@ -144,7 +144,7 @@ void scheduleEvents(EventBase* eventBase, int fd, ScheduledEvent* events) { ...@@ -144,7 +144,7 @@ void scheduleEvents(EventBase* eventBase, int fd, ScheduledEvent* events) {
class TestHandler : public EventHandler { class TestHandler : public EventHandler {
public: public:
TestHandler(EventBase* eventBase, int fd) TestHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, fd), fd_(fd) {} : EventHandler(eventBase, NetworkSocket::fromFd(fd)), fd_(fd) {}
void handlerReady(uint16_t events) noexcept override { void handlerReady(uint16_t events) noexcept override {
ssize_t bytesRead = 0; ssize_t bytesRead = 0;
...@@ -1470,7 +1470,7 @@ class TerminateTestCallback : public EventBase::LoopCallback, ...@@ -1470,7 +1470,7 @@ class TerminateTestCallback : public EventBase::LoopCallback,
public EventHandler { public EventHandler {
public: public:
TerminateTestCallback(EventBase* eventBase, int fd) TerminateTestCallback(EventBase* eventBase, int fd)
: EventHandler(eventBase, fd), : EventHandler(eventBase, NetworkSocket::fromFd(fd)),
eventBase_(eventBase), eventBase_(eventBase),
loopInvocations_(0), loopInvocations_(0),
maxLoopInvocations_(0), maxLoopInvocations_(0),
...@@ -1783,7 +1783,8 @@ TEST(EventBaseTest, RunBeforeLoopWait) { ...@@ -1783,7 +1783,8 @@ TEST(EventBaseTest, RunBeforeLoopWait) {
class PipeHandler : public EventHandler { class PipeHandler : public EventHandler {
public: public:
PipeHandler(EventBase* eventBase, int fd) : EventHandler(eventBase, fd) {} PipeHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, NetworkSocket::fromFd(fd)) {}
void handlerReady(uint16_t /* events */) noexcept override { void handlerReady(uint16_t /* events */) noexcept override {
abort(); abort();
......
...@@ -47,7 +47,8 @@ void runInThreadsAndWait(vector<function<void()>> cbs) { ...@@ -47,7 +47,8 @@ void runInThreadsAndWait(vector<function<void()>> cbs) {
class EventHandlerMock : public EventHandler { class EventHandlerMock : public EventHandler {
public: public:
EventHandlerMock(EventBase* eb, int fd) : EventHandler(eb, fd) {} EventHandlerMock(EventBase* eb, int fd)
: EventHandler(eb, NetworkSocket::fromFd(fd)) {}
// gmock can't mock noexcept methods, so we need an intermediary // gmock can't mock noexcept methods, so we need an intermediary
MOCK_METHOD1(_handlerReady, void(uint16_t)); MOCK_METHOD1(_handlerReady, void(uint16_t));
void handlerReady(uint16_t events) noexcept override { void handlerReady(uint16_t events) noexcept override {
...@@ -286,7 +287,8 @@ TEST_F(EventHandlerOobTest, EPOLLPRI) { ...@@ -286,7 +287,8 @@ TEST_F(EventHandlerOobTest, EPOLLPRI) {
acceptConn(); acceptConn();
struct SockEvent : public EventHandler { struct SockEvent : public EventHandler {
SockEvent(EventBase* eb, int fd) : EventHandler(eb, fd), fd_(fd) {} SockEvent(EventBase* eb, int fd)
: EventHandler(eb, NetworkSocket::fromFd(fd)), fd_(fd) {}
void handlerReady(uint16_t events) noexcept override { void handlerReady(uint16_t events) noexcept override {
EXPECT_TRUE(EventHandler::EventFlags::PRI & events); EXPECT_TRUE(EventHandler::EventFlags::PRI & events);
...@@ -335,7 +337,8 @@ TEST_F(EventHandlerOobTest, OOB_AND_NORMAL_DATA) { ...@@ -335,7 +337,8 @@ TEST_F(EventHandlerOobTest, OOB_AND_NORMAL_DATA) {
acceptConn(); acceptConn();
struct SockEvent : public EventHandler { struct SockEvent : public EventHandler {
SockEvent(EventBase* eb, int fd) : EventHandler(eb, fd), eb_(eb), fd_(fd) {} SockEvent(EventBase* eb, int fd)
: EventHandler(eb, NetworkSocket::fromFd(fd)), eb_(eb), fd_(fd) {}
void handlerReady(uint16_t events) noexcept override { void handlerReady(uint16_t events) noexcept override {
std::array<char, 255> buffer; std::array<char, 255> buffer;
...@@ -388,7 +391,8 @@ TEST_F(EventHandlerOobTest, SWALLOW_OOB) { ...@@ -388,7 +391,8 @@ TEST_F(EventHandlerOobTest, SWALLOW_OOB) {
acceptConn(); acceptConn();
struct SockEvent : public EventHandler { struct SockEvent : public EventHandler {
SockEvent(EventBase* eb, int fd) : EventHandler(eb, fd), fd_(fd) {} SockEvent(EventBase* eb, int fd)
: EventHandler(eb, NetworkSocket::fromFd(fd)), fd_(fd) {}
void handlerReady(uint16_t events) noexcept override { void handlerReady(uint16_t events) noexcept override {
std::array<char, 255> buffer; std::array<char, 255> buffer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment