summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/events.c114
1 files changed, 0 insertions, 114 deletions
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