diff --git a/src/core/ev.c b/src/core/ev.c index 0fe1bf7f..46be4862 100644 --- a/src/core/ev.c +++ b/src/core/ev.c @@ -1818,8 +1818,8 @@ void janet_loop1_impl(int has_timeout, JanetTimestamp timeout) { JanetStream *stream = janet_vm.streams[i]; janet_vm.fds[i + 1].events = 0; janet_vm.fds[i + 1].revents = 0; - if (stream->read_fiber) janet_vm.fds[i + 1].events |= POLLIN; - if (stream->write_fiber) janet_vm.fds[i + 1].events |= POLLOUT; + if (stream->read_fiber && stream->read_fiber->ev_callback) janet_vm.fds[i + 1].events |= POLLIN; + if (stream->write_fiber && stream->write_fiber->ev_callback) janet_vm.fds[i + 1].events |= POLLOUT; } /* Poll for events */ diff --git a/src/core/net.c b/src/core/net.c index 531cfcee..97e6418b 100644 --- a/src/core/net.c +++ b/src/core/net.c @@ -125,7 +125,7 @@ void net_callback_connect(JanetFiber *fiber, JanetAsyncEvent event) { default: break; #ifndef JANET_WINDOWS - /* Wait until we have an actually event before checking. + /* Wait until we have an actual event before checking. * Windows doesn't support async connect with this, just try immediately.*/ case JANET_ASYNC_EVENT_INIT: #endif @@ -160,7 +160,7 @@ void net_callback_connect(JanetFiber *fiber, JanetAsyncEvent event) { janet_async_end(fiber); } -static void net_sched_connect(JanetStream *stream) { +static JANET_NO_RETURN void net_sched_connect(JanetStream *stream) { NetStateConnect *state = janet_malloc(sizeof(NetStateConnect)); state->did_connect = 0; janet_async_start(stream, JANET_ASYNC_LISTEN_WRITE, net_callback_connect, state); @@ -575,7 +575,6 @@ JANET_CORE_FN(cfun_net_connect, } net_sched_connect(stream); - janet_await(); } static const char *serverify_socket(JSock sfd) {