Skip to content

Commit

Permalink
not impl emulate edge
Browse files Browse the repository at this point in the history
Signed-off-by: Yuchen Dai <[email protected]>
  • Loading branch information
lambdai committed Jan 23, 2021
1 parent e4c7e87 commit 7a6b91a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/extensions/io_socket/user_space/file_event_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "envoy/event/file_event.h"

#include "common/common/assert.h"
#include "common/event/dispatcher_impl.h"
#include "common/event/event_impl_base.h"

Expand All @@ -28,16 +29,15 @@ class FileEventImpl final : public Event::FileEvent, Logger::Loggable<Logger::Id

// This event always acts as edge triggered regardless the underlying OS is level or
// edge triggered. The event owner on windows platform should not emulate edge events.
void unregisterEventIfEmulatedEdge(uint32_t) override {}
void registerEventIfEmulatedEdge(uint32_t) override {}
void unregisterEventIfEmulatedEdge(uint32_t) override { NOT_IMPLEMENTED_GCOVR_EXCL_LINE; }
void registerEventIfEmulatedEdge(uint32_t) override { NOT_IMPLEMENTED_GCOVR_EXCL_LINE; }

// Notify events. Unlike activate() method, this method activates the given events only if the
// events are enabled.
void activateIfEnabled(uint32_t events);

private:
// This class maintains the ephemeral events and enabled events.
// getAndClearEphemeralEvents
class EventListener {
public:
~EventListener() = default;
Expand Down
8 changes: 8 additions & 0 deletions test/extensions/io_socket/user_space/file_event_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,14 @@ TEST_F(FileEventImplTest, EventClosedIsTriggeredByManullyActivate) {
dispatcher_->run(Event::Dispatcher::RunType::NonBlock);
}
}

TEST_F(FileEventImplTest, NotImplementedEmulatedEdge) {
user_file_event_ = std::make_unique<FileEventImpl>(
*dispatcher_, [this](uint32_t arg) { ready_cb_.called(arg); },
Event::FileReadyType::Write | Event::FileReadyType::Closed, io_source_);
EXPECT_DEATH({ user_file_event_->registerEventIfEmulatedEdge(0); }, "not implemented");
EXPECT_DEATH({ user_file_event_->unregisterEventIfEmulatedEdge(0); }, "not implemented");
}
} // namespace
} // namespace UserSpace
} // namespace IoSocket
Expand Down

0 comments on commit 7a6b91a

Please sign in to comment.