mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibCore: Don't fire Socket::on_ready_to_read if !can_read()
This is a bit of a pickle and I'm unsure what's the best behavior here. Since notifiers fire asynchronously via the event loop, we may end up firing a notifier for a socket fd, but then reading/writing that socket fd before ending up in the notifier callback. In that situation, the socket is no longer in the same state as it was when the event loop generated the notifier event. This patch stops Socket from firing one hook in this situation but this probably needs a global rethink. With this change, Browser starts reliably in multi-process mode. :^)
This commit is contained in:
parent
e5933ec739
commit
41066b009f
Notes:
sideshowbarker
2024-07-19 05:05:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/41066b009f6
1 changed files with 2 additions and 0 deletions
|
@ -204,6 +204,8 @@ void Socket::ensure_read_notifier()
|
|||
ASSERT(m_connected);
|
||||
m_read_notifier = Notifier::construct(fd(), Notifier::Event::Read, this);
|
||||
m_read_notifier->on_ready_to_read = [this] {
|
||||
if (!can_read())
|
||||
return;
|
||||
if (on_ready_to_read)
|
||||
on_ready_to_read();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue