LibCore: Use correct fd for NotifierActivationEvent on Windows

The initial IOCP event loop implementation had a fd() method for the
EventLoopNotifier packet that did not actually return the fd for the
notifier, but a to_fd() call on an object HANDLE that was always NULL.
This meant we were always posting NotifierActivationEvents with a fd of
0.

This rendered all of our WinSock2 I/O invalid, meaning no IPC messages
would ever be successfully sent or received.
This commit is contained in:
ayeteadoe 2025-11-17 13:18:53 -08:00 committed by Jelle Raaijmakers
parent 7d2f631d4c
commit 11b8bbeadf
Notes: github-actions[bot] 2025-11-18 17:51:01 +00:00

View file

@ -92,12 +92,12 @@ struct EventLoopNotifier final : CompletionPacket {
}
Notifier::Type notifier_type() const { return m_notifier_type; }
int fd() const { return to_fd(object_handle); }
int notifier_fd() const { return m_notifier_fd; }
// These are a space tradeoff for avoiding a double indirection through the notifier*.
Notifier* notifier;
Notifier::Type m_notifier_type;
HANDLE object_handle;
int m_notifier_fd { -1 };
OwnHandle wait_packet;
OwnHandle wait_event;
};
@ -187,8 +187,8 @@ size_t EventLoopImplementationWindows::pump(PumpMode pump_mode)
continue;
}
if (packet->type == CompletionType::Notifer) {
auto* notifier_data = reinterpret_cast<EventLoopNotifier*>(packet);
event_queue.post_event(*notifier_data->notifier, make<NotifierActivationEvent>(notifier_data->fd(), notifier_data->notifier_type()));
auto* notifier_data = static_cast<EventLoopNotifier*>(packet);
event_queue.post_event(*notifier_data->notifier, make<NotifierActivationEvent>(notifier_data->notifier_fd(), notifier_data->notifier_type()));
g_system.NtAssociateWaitCompletionPacket(notifier_data->wait_packet.handle, thread_data->iocp.handle, notifier_data->wait_event.handle, notifier_data, NULL, 0, 0, NULL);
continue;
}