]> git.saurik.com Git - redis.git/blobdiff - ae_epoll.c
modified a bit the ZREVRANGE test to cover a few lines of code more
[redis.git] / ae_epoll.c
index 8fb5d4c38aafd6ea0be50e49d87e8d1a9111fb8d..ce9ce3b0196c641f9932ad7ba178cdaab43fd6dc 100644 (file)
@@ -29,10 +29,13 @@ static void aeApiFree(aeEventLoop *eventLoop) {
 static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
     aeApiState *state = eventLoop->apidata;
     struct epoll_event ee;
+    /* If the fd was already monitored for some event, we need a MOD
+     * operation. Otherwise we need an ADD operation. */
     int op = eventLoop->events[fd].mask == AE_NONE ?
             EPOLL_CTL_ADD : EPOLL_CTL_MOD;
 
     ee.events = 0;
+    mask |= eventLoop->events[fd].mask; /* Merge old events */
     if (mask & AE_READABLE) ee.events |= EPOLLIN;
     if (mask & AE_WRITABLE) ee.events |= EPOLLOUT;
     if (mask & AE_EXCEPTION) ee.events |= EPOLLPRI;
@@ -85,3 +88,7 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
     }
     return numevents;
 }
+
+static char *aeApiName(void) {
+    return "epoll";
+}