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!
@@ -1646,8 +1646,21 @@ static void janet_unlisten(JanetListenerState *state, int is_gc) {
int is_last = (state->_next == NULL && stream->state == state);
int op = is_last ? EV_DELETE : EV_DISABLE | EV_ADD;
struct kevent kev[2];
+ /* Disabled, may be incorrect
EV_SET(&kev[0], stream->handle, EVFILT_READ, 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);
}
}
