From 5783b1a16966f98e9b54c66ef3ebd9b82000048b Mon Sep 17 00:00:00 2001
From: Andy Green <andy.green@linaro.org>
Date: Sat, 9 Jan 2016 04:12:46 +0800
Subject: [PATCH] libev set events to match revents

https://github.com/warmcat/libwebsockets/issues/393

Signed-off-by: Andy Green <andy.green@linaro.org>
---
 lib/libev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/libev.c b/lib/libev.c
index f81a7cf8..1310a773 100644
--- a/lib/libev.c
+++ b/lib/libev.c
@@ -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);
 }
 
-- 
GitLab