#include <freeradius-devel/util/worker.h>
#include <freeradius-devel/util/channel.h>
+#include <freeradius-devel/util/control.h>
#include <freeradius-devel/rad_assert.h>
/**
} while ((cd = fr_channel_recv_request(ch)) != NULL);
}
-/** Handle EVFILT_USER events
+/** Service an EVFILT_USER event
*
- * @todo fix for fr_channel_service_aq() also
+ * @param[in] kq the kq to service
+ * @param[in] kev the kevent to service
+ * @param[in] ctx the fr_worker_t
*/
-static void fr_worker_evfilt_user(UNUSED int kq, UNUSED struct kevent const *kev, UNUSED void *ctx)
+static void fr_worker_evfilt_user(UNUSED int kq, struct kevent const *kev, void *ctx)
{
-#if 0
- fr_channel_event_t what;
- fr_channel_t *ch;
- fr_time_t when = fr_time(); /* @todo pass in from caller */
fr_worker_t *worker = ctx;
- rad_assert(kev->filter == EVFILT_USER);
-
- what = fr_channel_service_kevent(worker->aq_control, kev, when, &ch);
-
- switch (what) {
- /*
- * The channel exchanged signaling
- * information. There's nothing for us
- * to do.
- */
- case FR_CHANNEL_EMPTY:
- case FR_CHANNEL_NOOP:
- case FR_CHANNEL_DATA_READY_RECEIVER:
- break;
-
- /*
- * Data is ready on this channel. Drain
- * it to the local to_decode heap.
- */
- case FR_CHANNEL_DATA_READY_WORKER:
- fr_worker_drain_input(worker, ch, NULL);
- break;
-
- /*
- * This is a new channel. Save it.
- *
- * @todo open a new channel
- */
- case FR_CHANNEL_OPEN:
- break;
-
- /*
- * The channel is closing. Stop it.
- *
- * @todo Close the channel
- */
- case FR_CHANNEL_CLOSE:
- break;
-
- /*
- * Oops. @todo Close the channel
- */
- case FR_CHANNEL_ERROR:
- return;
- }
+#ifndef NDEBUG
+ talloc_get_type_abort(worker, fr_worker_t);
#endif
+
+ (void) fr_control_message_service_kevent(worker->aq_control, kev);
}
+
/** Decode a request from either the localized queue, or the to_decode queue
*
* The request returned from this function MUST be immediately runnable.
return NULL;
}
+ if (fr_event_user_insert(worker->el, fr_worker_evfilt_user, worker) < 0) {
+ talloc_free(worker);
+ return NULL;
+ }
+
/*
* The worker thread starts now. Manually initialize it,
* because we're tracking request time, not the time that