]> granicus.if.org Git - libevent/commitdiff
Workaround in the unit tests for an apparent epoll bug in Linux 3.2
authorNick Mathewson <nickm@torproject.org>
Tue, 24 Jan 2012 16:04:19 +0000 (11:04 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 24 Jan 2012 16:04:19 +0000 (11:04 -0500)
test/regress_et.c

index 7b2d94a87e1e0716d995786aaf2eb4a8135235c8..0b871cfe2862d37407a5463722e6f0fd36bbc2f8 100644 (file)
@@ -54,21 +54,24 @@ static int was_et = 0;
 static void
 read_cb(evutil_socket_t fd, short event, void *arg)
 {
-       char buf;
-       int len;
+//     char buf;
+//     int len;
 
-       len = recv(fd, &buf, sizeof(buf), 0);
-
-       /*printf("%s: %s %d%s\n", __func__, event & EV_ET ? "etread" : "read",
-               len, len ? "" : " - means EOF");
-       */
+       /* On Linux 3.2.1 (at least, as patched by Fedora and tested by Nick),
+        * doing this "recv" resets the readability of the socket, even though
+        * there is no state change.  Yuck!  Linux 3.1.9 didn't have this
+        * problem.
+        */
+//     len = recv(fd, &buf, sizeof(buf), 0);
 
        called++;
        if (event & EV_ET)
                was_et = 1;
 
+#if 0
        if (!len)
                event_del(arg);
+#endif
 }
 
 #ifndef SHUT_WR
@@ -98,6 +101,7 @@ test_edgetriggered(void *et)
 
        send(pair[0], test, (int)strlen(test)+1, 0);
        shutdown(pair[0], SHUT_WR);
+       sleep(1);
 
        /* Initalize the event library */
        base = event_base_new();