summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ev.c7
-rw-r--r--ev.h4
-rw-r--r--ev_epoll.c4
-rw-r--r--ev_poll.c4
-rw-r--r--ev_select.c3
-rw-r--r--evdns.c4
-rw-r--r--event.c2
7 files changed, 17 insertions, 11 deletions
diff --git a/ev.c b/ev.c
index 5756bb7..2db968e 100644
--- a/ev.c
+++ b/ev.c
@@ -308,11 +308,8 @@ fd_reify (EV_P)
anfd->reify = 0;
- if (anfd->events != events)
- {
- method_modify (EV_A_ fd, anfd->events, events);
- anfd->events = events;
- }
+ method_modify (EV_A_ fd, anfd->events, events);
+ anfd->events = events;
}
fdchangecnt = 0;
diff --git a/ev.h b/ev.h
index ecca856..1b33bf2 100644
--- a/ev.h
+++ b/ev.h
@@ -268,7 +268,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
((struct ev_watcher *)(ev))->active = \
((struct ev_watcher *)(ev))->pending = \
((struct ev_watcher *)(ev))->priority = 0; \
- ((struct ev_watcher *)(ev))->cb = (cb_); \
+ (ev)->cb = (cb_); \
} while (0)
#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0)
@@ -293,7 +293,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
#define ev_is_active(ev) (0 + ((struct ev_watcher *)(ev))->active) /* ro, true when the watcher has been started */
#define ev_priority(ev) ((struct ev_watcher *)(ev))->priority /* rw */
-#define ev_cb(ev) ((struct ev_watcher *)(ev))->cb /* rw */
+#define ev_cb(ev) (ev)->cb /* rw */
#define ev_set_priority(ev,pri) ev_priority (ev) = (pri)
#define ev_set_cb(ev,cb_) ev_cb (ev) = (cb_)
diff --git a/ev_epoll.c b/ev_epoll.c
index ffb1f05..4689f8d 100644
--- a/ev_epoll.c
+++ b/ev_epoll.c
@@ -43,7 +43,9 @@ epoll_modify (EV_P_ int fd, int oev, int nev)
| (nev & EV_WRITE ? EPOLLOUT : 0);
if (epoll_ctl (epoll_fd, mode, fd, &ev))
- fd_kill (EV_A_ fd);
+ if (errno != ENOENT /* on ENOENT the fd went away, so try to do the right thing */
+ || (nev && epoll_ctl (epoll_fd, EPOLL_CTL_ADD, fd, &ev)))
+ fd_kill (EV_A_ fd);
}
static void
diff --git a/ev_poll.c b/ev_poll.c
index b858b45..b58ce82 100644
--- a/ev_poll.c
+++ b/ev_poll.c
@@ -42,6 +42,10 @@ static void
poll_modify (EV_P_ int fd, int oev, int nev)
{
int idx;
+
+ if (oev == nev)
+ return;
+
array_needsize (pollidxs, pollidxmax, fd + 1, pollidx_init);
idx = pollidxs [fd];
diff --git a/ev_select.c b/ev_select.c
index 327c313..9f81e55 100644
--- a/ev_select.c
+++ b/ev_select.c
@@ -48,6 +48,9 @@ select_modify (EV_P_ int fd, int oev, int nev)
int offs = fd >> 3;
int mask = 1 << (fd & 7);
+ if (oev == nev)
+ return;
+
if (vec_max < (fd >> 5) + 1)
{
int new_max = (fd >> 5) + 1;
diff --git a/evdns.c b/evdns.c
index e4e4e8f..3fd2a91 100644
--- a/evdns.c
+++ b/evdns.c
@@ -1,4 +1,4 @@
-/* $Id: evdns.c,v 1.11 2007-11-04 19:45:09 root Exp $ */
+/* $Id: evdns.c,v 1.12 2007-11-04 23:14:11 root Exp $ */
/* The original version of this module was written by Adam Langley; for
* a history of modifications, check out the subversion logs.
@@ -40,7 +40,7 @@
#endif
#ifdef WIN32
-#ifndef EV_EMBED
+#ifndef EV_STANDALONE
#include "misc.h"
#endif
#endif
diff --git a/event.c b/event.c
index b34774c..cf7739c 100644
--- a/event.c
+++ b/event.c
@@ -91,7 +91,7 @@ void *event_init (void)
#else
assert (("multiple event bases not supported when not compiled with EV_MULTIPLICITY", !x_cur));
- x_cur = (struct event_base *)ev_default_loop (EVMETHOD_AUTO);
+ x_cur = (struct event_base *)(long)ev_default_loop (EVMETHOD_AUTO);
#endif
return x_cur;