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)
: TimerFD(eventBase, createTimerFd()) {}
TimerFD::TimerFD(folly::EventBase* eventBase, int fd)
: folly::EventHandler(eventBase, fd), fd_(fd) {
: folly::EventHandler(eventBase, NetworkSocket::fromFd(fd)), fd_(fd) {
if (fd_ > 0) {
registerHandler(folly::EventHandler::READ | folly::EventHandler::PERSIST);
}
......
......@@ -61,8 +61,6 @@ class EventHandler {
* descriptor must be set separately using initHandler() or
* changeHandlerFD() before the handler can be registered.
*/
explicit EventHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, NetworkSocket::fromFd(fd)) {}
explicit EventHandler(
EventBase* eventBase = nullptr,
NetworkSocket fd = NetworkSocket());
......
......@@ -144,7 +144,7 @@ void scheduleEvents(EventBase* eventBase, int fd, ScheduledEvent* events) {
class TestHandler : public EventHandler {
public:
TestHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, fd), fd_(fd) {}
: EventHandler(eventBase, NetworkSocket::fromFd(fd)), fd_(fd) {}
void handlerReady(uint16_t events) noexcept override {
ssize_t bytesRead = 0;
......@@ -1470,7 +1470,7 @@ class TerminateTestCallback : public EventBase::LoopCallback,
public EventHandler {
public:
TerminateTestCallback(EventBase* eventBase, int fd)
: EventHandler(eventBase, fd),
: EventHandler(eventBase, NetworkSocket::fromFd(fd)),
eventBase_(eventBase),
loopInvocations_(0),
maxLoopInvocations_(0),
......@@ -1783,7 +1783,8 @@ TEST(EventBaseTest, RunBeforeLoopWait) {
class PipeHandler : public EventHandler {
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 {
abort();
......
......@@ -47,7 +47,8 @@ void runInThreadsAndWait(vector<function<void()>> cbs) {
class EventHandlerMock : public EventHandler {
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
MOCK_METHOD1(_handlerReady, void(uint16_t));
void handlerReady(uint16_t events) noexcept override {
......@@ -286,7 +287,8 @@ TEST_F(EventHandlerOobTest, EPOLLPRI) {
acceptConn();
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 {
EXPECT_TRUE(EventHandler::EventFlags::PRI & events);
......@@ -335,7 +337,8 @@ TEST_F(EventHandlerOobTest, OOB_AND_NORMAL_DATA) {
acceptConn();
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 {
std::array<char, 255> buffer;
......@@ -388,7 +391,8 @@ TEST_F(EventHandlerOobTest, SWALLOW_OOB) {
acceptConn();
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 {
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