1
0
mirror of https://github.com/janet-lang/janet synced 2024-10-18 16:05:47 +00:00

Only raise IOCP error on readable, writable, or acceptable streams.

We may create streams whose sole purpose is to wrap a file descriptor
and therefor don't need to be IOCP enabled / nonblocking.
This commit is contained in:
Calvin Rose 2024-08-06 07:06:34 -05:00
parent f3048a3d6b
commit 2b01b780da

View File

@ -1471,7 +1471,10 @@ void janet_ev_deinit(void) {
static void janet_register_stream(JanetStream *stream) { static void janet_register_stream(JanetStream *stream) {
if (NULL == CreateIoCompletionPort(stream->handle, janet_vm.iocp, (ULONG_PTR) stream, 0)) { if (NULL == CreateIoCompletionPort(stream->handle, janet_vm.iocp, (ULONG_PTR) stream, 0)) {
janet_panicf("failed to listen for events: %V", janet_ev_lasterr()); if (stream->flags & (JANET_STREAM_READABLE | JANET_STREAM_WRITABLE | JANET_STREAM_ACCEPTABLE)) {
janet_panicf("failed to listen for events: %V", janet_ev_lasterr());
}
stream->flags |= JANET_STREAM_UNREGISTERED;
} }
} }