Changeset df2e1eb8a0d6b779a1327d8df4d867b961ce4b07

Show
Ignore:
Timestamp:
12/04/08 16:35:03 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1228408503 +0000
git-parent:

[9295ab0de02cda482cfd2a5762f8a76727b480d1]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1228408503 +0000
Message:

fixed #66

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/eventer/eventer.h

    r4b96846 rdf2e1eb  
    7575  void              (*add)(eventer_t e); 
    7676  eventer_t         (*remove)(eventer_t e); 
    77   void              (*update)(eventer_t e); 
     77  void              (*update)(eventer_t e, int newmask); 
    7878  eventer_t         (*remove_fd)(int fd); 
    7979  eventer_t         (*find_fd)(int fd); 
  • src/eventer/eventer_epoll_impl.c

    rf920aec rdf2e1eb  
    159159  return removed; 
    160160} 
    161 static void eventer_epoll_impl_update(eventer_t e) { 
     161static void eventer_epoll_impl_update(eventer_t e, int mask) { 
    162162  struct epoll_event _ev; 
    163163  if(e->mask & EVENTER_TIMER) { 
     164    assert(e->mask & EVENTER_TIMER); 
    164165    pthread_mutex_lock(&te_lock); 
    165166    noit_skiplist_remove_compare(timed_events, e, NULL, noit_compare_voidptr); 
     
    170171  memset(&_ev, 0, sizeof(_ev)); 
    171172  _ev.data.fd = e->fd; 
     173  e->mask = mask; 
    172174  if(e->mask & (EVENTER_READ | EVENTER_WRITE | EVENTER_EXCEPTION)) { 
    173175    if(e->mask & EVENTER_READ) _ev.events |= (EPOLLIN|EPOLLPRI); 
  • src/eventer/eventer_kqueue_impl.c

    rf920aec rdf2e1eb  
    206206  return removed; 
    207207} 
    208 static void eventer_kqueue_impl_update(eventer_t e) { 
     208static void eventer_kqueue_impl_update(eventer_t e, int mask) { 
    209209  if(e->mask & EVENTER_TIMER) { 
     210    assert(mask & EVENTER_TIMER); 
    210211    pthread_mutex_lock(&te_lock); 
    211212    noit_skiplist_remove_compare(timed_events, e, NULL, noit_compare_voidptr); 
     
    214215    return; 
    215216  } 
    216   ke_change(e->fd, EVFILT_READ, EV_DELETE | EV_DISABLE, e); 
    217   ke_change(e->fd, EVFILT_WRITE, EV_DELETE | EV_DISABLE, e); 
    218   if(e->mask & (EVENTER_READ | EVENTER_EXCEPTION)) 
     217  /* Disable old, if they aren't active in the new */ 
     218  if((e->mask & (EVENTER_READ | EVENTER_EXCEPTION)) && 
     219     !(mask & (EVENTER_READ | EVENTER_EXCEPTION))) 
    219220    ke_change(e->fd, EVFILT_READ, EV_DELETE | EV_DISABLE, e); 
    220   if(e->mask & (EVENTER_WRITE)) 
     221  if((e->mask & (EVENTER_WRITE)) && 
     222     !(mask & (EVENTER_WRITE))) 
    221223    ke_change(e->fd, EVFILT_WRITE, EV_DELETE | EV_DISABLE, e); 
     224 
     225  /* Enable new, if the weren't in the old */ 
     226  if((mask & (EVENTER_READ | EVENTER_EXCEPTION)) && 
     227     !(e->mask & (EVENTER_READ | EVENTER_EXCEPTION))) 
     228    ke_change(e->fd, EVFILT_READ, EV_ADD | EV_ENABLE, e); 
     229  if((mask & (EVENTER_WRITE)) && 
     230     !(e->mask & (EVENTER_WRITE))) 
     231    ke_change(e->fd, EVFILT_WRITE, EV_ADD | EV_ENABLE, e); 
     232 
     233  /* Switch */ 
     234  e->mask = mask; 
    222235} 
    223236static eventer_t eventer_kqueue_impl_remove_fd(int fd) { 
  • src/eventer/eventer_ports_impl.c

    r3d709f8 rdf2e1eb  
    175175  return removed; 
    176176} 
    177 static void eventer_ports_impl_update(eventer_t e) { 
     177static void eventer_ports_impl_update(eventer_t e, int mask) { 
    178178  if(e->mask & EVENTER_TIMER) { 
     179    assert(mask & EVENTER_TIMER); 
    179180    pthread_mutex_lock(&te_lock); 
    180181    noit_skiplist_remove_compare(timed_events, e, NULL, noit_compare_voidptr); 
     
    183184    return; 
    184185  } 
    185   alter_fd(e, e->mask); 
     186  alter_fd(e, mask); 
     187  e->mask = mask; 
    186188} 
    187189static eventer_t eventer_ports_impl_remove_fd(int fd) { 
  • src/noit_console.c

    rdb656f3 rdf2e1eb  
    437437  while((rv = noit_console_continue_sending(ncct, &mask)) == -1 && errno == EINTR); 
    438438  if(rv == -1 && errno == EAGAIN) { 
    439     ncct->e->mask = mask | EVENTER_EXCEPTION; 
    440     eventer_update(ncct->e); 
     439    eventer_update(ncct->e, mask | EVENTER_EXCEPTION); 
    441440  } 
    442441  return rlen; 
  • src/noit_http.c

    r55168c7 rdf2e1eb  
    647647  _http_perform_write(ctx, &mask); 
    648648  if(ctx->conn.e) { 
    649     ctx->conn.e->mask = mask; 
    650     eventer_update(ctx->conn.e); 
     649    eventer_update(ctx->conn.e, mask); 
    651650  } 
    652651  return noit_true;