fr_event_timer_t const *ev; //!< for detail file timers.
RADCLIENT *client; //!< so the rest of the server doesn't complain
+
+ fr_network_t *nr; //!< for Linux-specific callbacks
} proto_detail_work_t;
typedef struct proto_detail_process_t {
DEBUG3("proto_detail (%s): Obtained lock and starting to process file %s",
inst->name, inst->filename_work);
+ MEM(listen = talloc_zero(NULL, fr_listen_t));
+
/*
* The worker may be in a different thread, so avoid
* talloc threading issues by using a NULL TALLOC_CTX.
*/
- work = talloc(NULL, proto_detail_work_t);
+ work = talloc(listen, proto_detail_work_t);
if (!work) {
+ talloc_free(listen);
DEBUG("Failed allocating memory");
return;
}
inst->name, inst->filename_work, fr_syserror(errno));
close(fd);
- talloc_free(work);
+ talloc_free(listen);
when.tv_sec = 0;
when.tv_usec = 10; /* hard-code! */
* This listener is parented from the worker. So that
* when the worker goes away, so does the listener.
*/
- listen = talloc_zero(work, fr_listen_t);
-
listen->app_io = inst->parent->work_io;
listen->app_io_instance = work;
(void) fr_event_fd_delete(inst->el, work->fd, FR_EVENT_FILTER_VNODE);
(void) fr_event_fd_delete(inst->el, work->fd, FR_EVENT_FILTER_IO);
if (listen) (void) listen->app_io->detach(listen->app_io_instance);
- talloc_free(work);
+ talloc_free(listen);
return;
}
/*
* All of the decoding is done by proto_detail.c
*/
-static int mod_decode(UNUSED void const *instance, REQUEST *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
+static int mod_decode(void const *instance, REQUEST *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
{
- proto_detail_work_t const *inst = talloc_get_type_abort_const(instance, proto_detail_work_t);
+ proto_detail_work_t const *inst = talloc_get_type_abort_const(instance, proto_detail_work_t);
fr_detail_entry_t const *track = request->async->packet_ctx;
VALUE_PAIR *vp;
}
-static void work_retransmit(UNUSED fr_event_list_t *el, UNUSED struct timeval *now, UNUSED void *uctx)
+static void work_retransmit(UNUSED fr_event_list_t *el, UNUSED struct timeval *now, void *uctx)
{
fr_detail_entry_t *track = talloc_get_type_abort(uctx, fr_detail_entry_t);
proto_detail_work_t *inst = talloc_parent(track);
* the correct read offset.
*/
(void) lseek(inst->fd, 0, SEEK_SET);
+
+#ifdef __linux__
+ fr_network_listen_read(inst->nr, talloc_parent(inst));
+#endif
}
static ssize_t mod_write(void *instance, void *packet_ctx,
inst->fd = -1;
if (inst->free_on_close) {
- talloc_free(inst);
+ talloc_free(talloc_parent(inst));
}
return 0;
#endif
inst->el = el;
+ inst->nr = nr;
}