diff options
| author | root <root> | 2007-11-04 23:14:11 +0000 | 
|---|---|---|
| committer | root <root> | 2007-11-04 23:14:11 +0000 | 
| commit | 22b2a449105d7604f715c1afafeb4fe5ac473f1b (patch) | |
| tree | b18e0643b0b285e16de1ac4641e5aecdc59c1bec | |
| parent | fbe9562600fa8735c078401aa604b49a5426b0e2 (diff) | |
- have to re-check potentially closed fds regularly for epoll. this hurts
  badly :(
- still more than twice as fats as libevent.
- many minor fixes
| -rw-r--r-- | ev.c | 7 | ||||
| -rw-r--r-- | ev.h | 4 | ||||
| -rw-r--r-- | ev_epoll.c | 4 | ||||
| -rw-r--r-- | ev_poll.c | 4 | ||||
| -rw-r--r-- | ev_select.c | 3 | ||||
| -rw-r--r-- | evdns.c | 4 | ||||
| -rw-r--r-- | event.c | 2 | 
7 files changed, 17 insertions, 11 deletions
| @@ -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; @@ -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_) @@ -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 @@ -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; @@ -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 @@ -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; | 
