-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
event: assert the case of both read and closed event registered #18265
Changes from 1 commit
2230a06
6d769f1
e931f3d
488936f
ae5004f
98774b7
1fe505c
481a41c
ca33eef
308ffbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,10 +135,8 @@ void FileEventImpl::registerEventIfEmulatedEdge(uint32_t event) { | |
ASSERT((event & (FileReadyType::Read | FileReadyType::Write)) == event); | ||
if (trigger_ == FileTriggerType::EmulatedEdge) { | ||
auto new_event_mask = enabled_events_ | event; | ||
if (event & FileReadyType::Read && (enabled_events_ & FileReadyType::Closed)) { | ||
// We never ask for both early close and read at the same time. | ||
new_event_mask = new_event_mask & ~FileReadyType::Read; | ||
} | ||
// We never ask for both early close and read at the same time. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @davinci26 Can you confirm that libevent on Windows supports EV_CLOSE? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does EV_CLOSE correspond to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like it. I guess Windows and Linux support this, but not Mac which uses the kqueue for event handling in libevent. |
||
ASSERT(!(event & FileReadyType::Read && (enabled_events_ & FileReadyType::Closed))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to ASSERT against new_event_mask instead. |
||
updateEvents(new_event_mask); | ||
} | ||
} | ||
|
@@ -150,11 +148,10 @@ void FileEventImpl::mergeInjectedEventsAndRunCb(uint32_t events) { | |
// TODO(antoniovicente) remove this adjustment to activation events once ConnectionImpl can | ||
// handle Read and Close events delivered together. | ||
if constexpr (PlatformDefaultTriggerType == FileTriggerType::EmulatedEdge) { | ||
if (events & FileReadyType::Closed && injected_activation_events_ & FileReadyType::Read) { | ||
// We never ask for both early close and read at the same time. If close is requested | ||
// keep that instead. | ||
injected_activation_events_ = injected_activation_events_ & ~FileReadyType::Read; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above, this is a change in behavior. Adding an ASSERT is not a guarantee that these cases won't come up while running a real proxy. Also note that injected_activation_events_ may contain events that the connection is not registered for. I don't think it happens often but it is technically allowed. |
||
} | ||
// We never ask for both early close and read at the same time. If close is requested | ||
// keep that instead. | ||
ASSERT( | ||
!(events & FileReadyType::Closed && injected_activation_events_ & FileReadyType::Read)); | ||
} | ||
|
||
events |= injected_activation_events_; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem safe to me to remove this code. This is a change in behavior in cases where the ASSERT above about not allowing read and closed at the same time fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, let me add it back.