1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 01:37:19 +00:00

Fix incorrect use of EV_SET on pipes (part 2)

Forgot that we use nearly the same routine for adding and deletion...
can't go around deleting things we haven't put into the changeset!
This commit is contained in:
llmII 2021-09-03 22:33:28 -05:00
parent c133443eb7
commit 95891eb0a5
No known key found for this signature in database
GPG Key ID: E3AD2E259F58A9A0

View File

@ -1646,8 +1646,21 @@ static void janet_unlisten(JanetListenerState *state, int is_gc) {
int is_last = (state->_next == NULL && stream->state == state); int is_last = (state->_next == NULL && stream->state == state);
int op = is_last ? EV_DELETE : EV_DISABLE | EV_ADD; int op = is_last ? EV_DELETE : EV_DISABLE | EV_ADD;
struct kevent kev[2]; struct kevent kev[2];
/* Disabled, may be incorrect
EV_SET(&kev[0], stream->handle, EVFILT_READ, op, 0, 0, stream); EV_SET(&kev[0], stream->handle, EVFILT_READ, op, 0, 0, stream);
EV_SET(&kev[1], stream->handle, EVFILT_WRITE, op, 0, 0, stream); EV_SET(&kev[1], stream->handle, EVFILT_WRITE, op, 0, 0, stream);
*/
int length = 0;
if (stream->_mask & JANET_ASYNC_EVENT_WRITE) {
EV_SET(&kev[length], stream->handle, EVFILT_WRITE, op, 0, 0, stream);
length++;
}
if (stream->_mask & JANET_ASYNC_EVENT_READ) {
EV_SET(&kev[length], stream->handle, EVFILT_READ, op, 0, 0, stream);
length++;
}
add_kqueue_events(kev, 2); add_kqueue_events(kev, 2);
} }
} }