int fr_event_now(fr_event_list_t *el, struct timeval *when);
-int fr_event_fd_insert(fr_event_list_t *el, int fd, fr_event_fd_handler_t handler, void *ctx);
+int fr_event_fd_insert(fr_event_list_t *el, int fd, fr_event_fd_handler_t handler, fr_event_fd_handler_t write,
+ fr_event_fd_handler_t error, void *ctx);
int fr_event_fd_delete(fr_event_list_t *el, int fd);
*
* @param[in] el to insert FD callback into.
* @param[in] fd to read from.
- * @param[in] read to call when fd is readable.
+ * @param[in] read function to call when fd is readable.
+ * @param[in] write function to call when fd is writable.
+ * @param[in] error function to call when an error occurs on the fd.
* @param[in] ctx to pass to handler.
*/
-int fr_event_fd_insert(fr_event_list_t *el, int fd, fr_event_fd_handler_t read, void *ctx)
+int fr_event_fd_insert(fr_event_list_t *el, int fd,
+ fr_event_fd_handler_t read, UNUSED fr_event_fd_handler_t write, UNUSED fr_event_fd_handler_t error,
+ void *ctx)
{
int i;
fr_event_fd_t *ef;
ev->inst = module_instance;
ev->ctx = ctx;
- if (fr_event_fd_insert(request->el, fd, unlang_event_fd_handler, ev) < 0) {
+ if (fr_event_fd_insert(request->el, fd, unlang_event_fd_handler, NULL, NULL, ev) < 0) {
talloc_free(ev);
return -1;
}
/*
* All sockets: add the FD to the event handler.
*/
- if (fr_event_fd_insert(el, this->fd, event_socket_handler, this) < 0) {
+ if (fr_event_fd_insert(el, this->fd, event_socket_handler, NULL, NULL, this) < 0) {
ERROR("Failed adding event handler for socket: %s", fr_strerror());
fr_exit(1);
}
}
DEBUG4("Created signal pipe. Read end FD %i, write end FD %i", self_pipe[0], self_pipe[1]);
- if (fr_event_fd_insert(el, self_pipe[0], event_signal_handler, el) < 0) {
+ if (fr_event_fd_insert(el, self_pipe[0], event_signal_handler, NULL, NULL, el) < 0) {
ERROR("Failed creating signal pipe handler: %s", fr_strerror());
return -1;
}
exit(EXIT_FAILURE);
}
- if (fr_event_fd_insert(events, self_pipe[0], rs_signal_action, events) < 0) {
+ if (fr_event_fd_insert(events, self_pipe[0], rs_signal_action, NULL, NULL, events) < 0) {
ERROR("Failed inserting signal pipe descriptor: %s", fr_strerror());
goto finish;
}
event->out = out;
event->stats = stats;
- if (fr_event_fd_insert(events, in_p->fd, rs_got_packet, event) < 0) {
+ if (fr_event_fd_insert(events, in_p->fd, rs_got_packet, NULL, NULL, event) < 0) {
ERROR("Failed inserting file descriptor");
goto finish;
}
local_backlog = fr_heap_create(timestamp_cmp, offsetof(REQUEST, heap_id));
rad_assert(local_backlog != NULL);
- if (fr_event_fd_insert(el, thread->pipe_fd[0], thread_fd_handler, thread) < 0) {
+ if (fr_event_fd_insert(el, thread->pipe_fd[0], thread_fd_handler, NULL, NULL, thread) < 0) {
ERROR("Failed inserting event for self");
goto done;
}
fcntl(session->pipefd[1], F_SETFL, O_NONBLOCK | FD_CLOEXEC);
#endif
- if (fr_event_fd_insert(session->el, session->pipefd[0], bfd_pipe_recv, session) < 0) {
+ if (fr_event_fd_insert(session->el, session->pipefd[0], bfd_pipe_recv, NULL, NULL, session) < 0) {
ERROR("Failed inserting file descriptor into event list: %s", fr_strerror());
goto close_pipes;
}
return -1;
}
- if (fr_event_fd_insert(el, sockfd, mod_event_fd, conn) < 0) {
+ if (fr_event_fd_insert(el, sockfd, mod_event_fd, NULL, NULL, conn) < 0) {
DEBUG("Failed adding event for socket: %s", fr_strerror());
close(sockfd);
return -1;
inst->log_fd = ub_fd(inst->ub);
if (inst->log_fd >= 0) {
- if (fr_event_fd_insert(inst->el, inst->log_fd, ub_fd_handler, inst) < 0) {
+ if (fr_event_fd_insert(inst->el, inst->log_fd, ub_fd_handler, NULL, NULL, inst) < 0) {
cf_log_err_cs(conf, "could not insert async fd");
inst->log_fd = -1;
goto error_nores;