mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Workaround in the unit tests for an apparent epoll bug in Linux 3.2
This commit is contained in:
parent
3f18ad1b5f
commit
dab91877bc
@ -54,21 +54,24 @@ static int was_et = 0;
|
|||||||
static void
|
static void
|
||||||
read_cb(evutil_socket_t fd, short event, void *arg)
|
read_cb(evutil_socket_t fd, short event, void *arg)
|
||||||
{
|
{
|
||||||
char buf;
|
// char buf;
|
||||||
int len;
|
// int len;
|
||||||
|
|
||||||
len = recv(fd, &buf, sizeof(buf), 0);
|
/* 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
|
||||||
/*printf("%s: %s %d%s\n", __func__, event & EV_ET ? "etread" : "read",
|
* there is no state change. Yuck! Linux 3.1.9 didn't have this
|
||||||
len, len ? "" : " - means EOF");
|
* problem.
|
||||||
*/
|
*/
|
||||||
|
// len = recv(fd, &buf, sizeof(buf), 0);
|
||||||
|
|
||||||
called++;
|
called++;
|
||||||
if (event & EV_ET)
|
if (event & EV_ET)
|
||||||
was_et = 1;
|
was_et = 1;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (!len)
|
if (!len)
|
||||||
event_del(arg);
|
event_del(arg);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SHUT_WR
|
#ifndef SHUT_WR
|
||||||
@ -98,6 +101,7 @@ test_edgetriggered(void *et)
|
|||||||
|
|
||||||
send(pair[0], test, (int)strlen(test)+1, 0);
|
send(pair[0], test, (int)strlen(test)+1, 0);
|
||||||
shutdown(pair[0], SHUT_WR);
|
shutdown(pair[0], SHUT_WR);
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
/* Initalize the event library */
|
/* Initalize the event library */
|
||||||
base = event_base_new();
|
base = event_base_new();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user