diff options
author | Volker Lendecke <vl@samba.org> | 2011-02-07 15:24:07 +0100 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2011-02-28 16:40:19 +0100 |
commit | cf7d331511437cc0be7d2dfa9263da5658d96740 (patch) | |
tree | 0f597e08e8b3ce952a23f115571a49c7432ccce1 | |
parent | ada2a5a2457ad0f91fc19e5de9391abbf059a93b (diff) | |
download | samba-cf7d331511437cc0be7d2dfa9263da5658d96740.tar.gz samba-cf7d331511437cc0be7d2dfa9263da5658d96740.tar.bz2 samba-cf7d331511437cc0be7d2dfa9263da5658d96740.zip |
s3: Remove select-based s3 event backend
-rw-r--r-- | source3/include/event.h | 5 | ||||
-rw-r--r-- | source3/lib/events.c | 114 |
2 files changed, 0 insertions, 119 deletions
diff --git a/source3/include/event.h b/source3/include/event.h index c6689d9e91..d69b333336 100644 --- a/source3/include/event.h +++ b/source3/include/event.h @@ -26,11 +26,6 @@ /* The following definitions come from lib/events.c */ -bool event_add_to_select_args(struct event_context *event_ctx, - fd_set *read_fds, fd_set *write_fds, - struct timeval *timeout, int *maxfd); -bool run_events(struct event_context *event_ctx, - int selrtn, fd_set *read_fds, fd_set *write_fds); struct timeval *get_timed_events_timeout(struct event_context *event_ctx, struct timeval *to_ret); void dump_event_list(struct event_context *event_ctx); diff --git a/source3/lib/events.c b/source3/lib/events.c index f850d23da2..d19c79e34b 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -23,120 +23,6 @@ #include "../lib/util/select.h" #include "system/select.h" -/* - * Return if there's something in the queue - */ - -bool event_add_to_select_args(struct tevent_context *ev, - fd_set *read_fds, fd_set *write_fds, - struct timeval *timeout, int *maxfd) -{ - struct timeval now; - struct tevent_fd *fde; - struct timeval diff; - bool ret = false; - - for (fde = ev->fd_events; fde; fde = fde->next) { - if (fde->flags & EVENT_FD_READ) { - FD_SET(fde->fd, read_fds); - ret = true; - } - if (fde->flags & EVENT_FD_WRITE) { - FD_SET(fde->fd, write_fds); - ret = true; - } - - if ((fde->flags & (EVENT_FD_READ|EVENT_FD_WRITE)) - && (fde->fd > *maxfd)) { - *maxfd = fde->fd; - } - } - - if (ev->immediate_events != NULL) { - *timeout = timeval_zero(); - return true; - } - - if (ev->timer_events == NULL) { - return ret; - } - - now = timeval_current(); - diff = timeval_until(&now, &ev->timer_events->next_event); - *timeout = timeval_min(timeout, &diff); - - return true; -} - -bool run_events(struct tevent_context *ev, - int selrtn, fd_set *read_fds, fd_set *write_fds) -{ - struct tevent_fd *fde; - struct timeval now; - - if (ev->signal_events && - tevent_common_check_signal(ev)) { - return true; - } - - if (ev->immediate_events && - tevent_common_loop_immediate(ev)) { - return true; - } - - GetTimeOfDay(&now); - - if ((ev->timer_events != NULL) - && (timeval_compare(&now, &ev->timer_events->next_event) >= 0)) { - /* this older events system did not auto-free timed - events on running them, and had a race condition - where the event could be called twice if the - talloc_free of the te happened after the callback - made a call which invoked the event loop. To avoid - this while still allowing old code which frees the - te, we need to create a temporary context which - will be used to ensure the te is freed. We also - remove the te from the timed event list before we - call the handler, to ensure we can't loop */ - - struct tevent_timer *te = ev->timer_events; - TALLOC_CTX *tmp_ctx = talloc_new(ev); - - DEBUG(10, ("Running timed event \"%s\" %p\n", - ev->timer_events->handler_name, ev->timer_events)); - - DLIST_REMOVE(ev->timer_events, te); - talloc_steal(tmp_ctx, te); - - te->handler(ev, te, now, te->private_data); - - talloc_free(tmp_ctx); - return true; - } - - if (selrtn <= 0) { - /* - * No fd ready - */ - return false; - } - - for (fde = ev->fd_events; fde; fde = fde->next) { - uint16 flags = 0; - - if (FD_ISSET(fde->fd, read_fds)) flags |= EVENT_FD_READ; - if (FD_ISSET(fde->fd, write_fds)) flags |= EVENT_FD_WRITE; - - if (flags & fde->flags) { - DLIST_DEMOTE(ev->fd_events, fde, struct tevent_fd); - fde->handler(ev, fde, flags, fde->private_data); - return true; - } - } - - return false; -} - struct tevent_poll_private { /* * Index from file descriptor into the pollfd array |