1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibCore: Allow listening for socket errors and hang-ups

This commit is contained in:
Dan Klishch 2024-02-01 21:51:36 -05:00 committed by Andrew Kaster
parent 6836091a21
commit 506707cc2b
Notes: sideshowbarker 2024-07-17 01:27:18 +09:00
2 changed files with 6 additions and 0 deletions

View file

@ -83,6 +83,8 @@ enum class NotificationType {
None = 0, None = 0,
Read = 1, Read = 1,
Write = 2, Write = 2,
HangUp = 4,
Error = 8,
}; };
AK_ENUM_BITWISE_OPERATORS(NotificationType); AK_ENUM_BITWISE_OPERATORS(NotificationType);

View file

@ -267,6 +267,10 @@ try_select_again:
type |= NotificationType::Read; type |= NotificationType::Read;
if (has_flag(revents, POLLOUT)) if (has_flag(revents, POLLOUT))
type |= NotificationType::Write; type |= NotificationType::Write;
if (has_flag(revents, POLLHUP))
type |= NotificationType::HangUp;
if (has_flag(revents, POLLERR))
type |= NotificationType::Error;
type &= notifier.type(); type &= notifier.type();
if (type != NotificationType::None) if (type != NotificationType::None)
ThreadEventQueue::current().post_event(notifier, make<NotifierActivationEvent>(notifier.fd(), type)); ThreadEventQueue::current().post_event(notifier, make<NotifierActivationEvent>(notifier.fd(), type));