libev set events to match revents
authorAndy Green <andy.green@linaro.org>
Fri, 8 Jan 2016 20:12:46 +0000 (04:12 +0800)
committerAndy Green <andy.green@linaro.org>
Fri, 8 Jan 2016 20:12:46 +0000 (04:12 +0800)
https://github.com/warmcat/libwebsockets/issues/393

Signed-off-by: Andy Green <andy.green@linaro.org>
lib/libev.c

index f81a7cf..1310a77 100644 (file)
@@ -41,13 +41,16 @@ lws_accept_cb(struct ev_loop *loop, struct ev_io *watcher, int revents)
                return;
 
        eventfd.fd = watcher->fd;
+       eventfd.events = 0;
        eventfd.revents = EV_NONE;
-       if (revents & EV_READ)
+       if (revents & EV_READ) {
+               eventfd.events |= LWS_POLLIN;
                eventfd.revents |= LWS_POLLIN;
-
-       if (revents & EV_WRITE)
+       }
+       if (revents & EV_WRITE) {
+               eventfd.events |= LWS_POLLOUT;
                eventfd.revents |= LWS_POLLOUT;
-
+       }
        lws_service_fd(context, &eventfd);
 }