#include <event.h>
#include <evutil.h>
-static int count, writes, fired;
+static int count, writes, fired, failures;
static evutil_socket_t *pipes;
static int num_pipes, num_active, num_writes;
static struct event *events;
{
ev_intptr_t idx = (ev_intptr_t) arg, widx = idx + 1;
u_char ch;
+ ev_ssize_t n;
- count += recv(fd, (char*)&ch, sizeof(ch), 0);
+ n = recv(fd, (char*)&ch, sizeof(ch), 0);
+ if (n >= 0)
+ count += n;
+ else
+ failures++
if (writes) {
if (widx >= num_pipes)
widx -= num_pipes;
- (void) send(pipes[2 * widx + 1], "e", 1, 0);
+ n = send(pipes[2 * widx + 1], "e", 1, 0);
+ if (n != 1)
+ failures++
writes--;
fired++;
}
evhttp_bind_socket(http, "0.0.0.0", port);
+#ifdef _WIN32
if (use_iocp) {
struct timeval tv={99999999,0};
event_base_loopexit(base, &tv);
}
+#endif
event_base_dispatch(base);
/* NOTREACHED */