From: Arran Cudbard-Bell Date: Tue, 22 Apr 2025 20:06:51 +0000 (-0500) Subject: Remove incorrect condition in bfd/session.c, rename fields to consistently identify... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36265d5f2f36503dcc819f23214f41fed6a04e5b;p=thirdparty%2Ffreeradius-server.git Remove incorrect condition in bfd/session.c, rename fields to consistently identify events --- diff --git a/src/lib/redis/io.h b/src/lib/redis/io.h index f89ea19b988..f760ebab7b4 100644 --- a/src/lib/redis/io.h +++ b/src/lib/redis/io.h @@ -68,7 +68,7 @@ typedef struct { bool write_set; //!< We're listening for writes. bool ignore_disconnect_cb; //!< Ensure that redisAsyncFree doesn't cause ///< a callback loop. - fr_timer_t *timer; //!< Connection timer. + fr_timer_t *timer_ev; //!< Connection timer. redisAsyncContext *ac; //!< Async handle for hiredis. diff --git a/src/listen/bfd/session.c b/src/listen/bfd/session.c index 2c8a0a4a726..b7fbbbb73e1 100644 --- a/src/listen/bfd/session.c +++ b/src/listen/bfd/session.c @@ -105,8 +105,8 @@ static int bfd_stop_poll(bfd_session_t *session) * re-set the timers. */ if (!session->remote_demand_mode) { - fr_assert(session->ev_timeout != NULL); - fr_assert(session->ev_packet != NULL); + fr_assert(session->timeout_ev != NULL); + fr_assert(session->packet_ev != NULL); bfd_stop_control(session); bfd_start_control(session); @@ -812,12 +812,10 @@ static void bfd_start_packets(bfd_session_t *session) uint64_t jitter; fr_timer_cb_t cb; - if (session->ev_packet) return; - /* * Reset the timers. */ - FR_TIMER_DISARM(session->ev_packet); + FR_TIMER_DISARM(session->packet_ev); if (fr_time_delta_cmp(session->desired_min_tx_interval, session->remote_min_rx_interval) >= 0) { interval = fr_time_delta_unwrap(session->desired_min_tx_interval); @@ -860,7 +858,7 @@ static void bfd_start_packets(bfd_session_t *session) cb = bfd_send_packet; } - if (fr_timer_in(session, session->el->tl, &session->ev_packet, + if (fr_timer_in(session, session->el->tl, &session->packet_ev, fr_time_delta_wrap(interval), false, cb, session) < 0) { fr_assert("Failed to insert event" == NULL); @@ -998,7 +996,7 @@ static void bfd_set_timeout(bfd_session_t *session, fr_time_t when) timeout = fr_time_add(when, delta); - if (fr_timer_at(session, session->el->tl, &session->ev_timeout, + if (fr_timer_at(session, session->el->tl, &session->timeout_ev, timeout, false, bfd_detection_timeout, session) < 0) { fr_assert("Failed to insert event" == NULL); } @@ -1010,8 +1008,8 @@ static void bfd_set_timeout(bfd_session_t *session, fr_time_t when) */ static int bfd_stop_control(bfd_session_t *session) { - FR_TIMER_DISARM(session->ev_timeout); - FR_TIMER_DISARM(session->ev_packet); + FR_TIMER_DISARM(session->timeout_ev); + FR_TIMER_DISARM(session->packet_ev); return 1; } diff --git a/src/listen/bfd/session.h b/src/listen/bfd/session.h index 493b64effa7..e7dda820d92 100644 --- a/src/listen/bfd/session.h +++ b/src/listen/bfd/session.h @@ -54,8 +54,8 @@ typedef struct { /* * Internal state management */ - fr_timer_t *ev_timeout; //!< when we time out for not receiving a packet - fr_timer_t *ev_packet; //!< for when we next send a packet + fr_timer_t *timeout_ev; //!< when we time out for not receiving a packet + fr_timer_t *packet_ev; //!< for when we next send a packet fr_time_t last_recv; //!< last received packet fr_time_t next_recv; //!< when we next expect to receive a packet fr_time_t last_sent; //!< the last time we sent a packet diff --git a/src/modules/rlm_unbound/io.c b/src/modules/rlm_unbound/io.c index cf691c2a914..c790b42f8fc 100644 --- a/src/modules/rlm_unbound/io.c +++ b/src/modules/rlm_unbound/io.c @@ -61,7 +61,7 @@ typedef struct { unbound_io_event_base_t *ev_b; //!< Event base this handle was created for. - fr_timer_t *timer; //!< Stores the pointer to the enabled timer for + fr_timer_t *timer_ev; //!< Stores the pointer to the enabled timer for ///< this event handled. libunbound uses a single ///< handle for managing related FD events and ///< timers, which is weird, but ok... @@ -233,7 +233,7 @@ static void _unbound_io_service_errored(UNUSED fr_event_list_t *el, * that it fired. This is imperfect but unbound * doesn't have a callback for receiving errors. */ - FR_TIMER_DISARM(ev->timer); + FR_TIMER_DISARM(ev->timer_ev); ev->cb(-1, UB_EV_TIMEOUT, ev->uctx); /* Call libunbound - pretend this is a timeout */ } @@ -306,7 +306,7 @@ static int _unbound_io_event_activate(struct ub_event *ub_ev, struct timeval *tv DEBUG4("unbound event %p - Timeout in %pV seconds", ev, fr_box_time_delta(timeout)); - if (fr_timer_in(ev, ev->ev_b->el->tl, &ev->timer, + if (fr_timer_in(ev, ev->ev_b->el->tl, &ev->timer_ev, timeout, false, _unbound_io_service_timer_expired, ev) < 0) { PERROR("unbound event %p - Failed adding timeout", ev); @@ -346,7 +346,7 @@ static int _unbound_io_event_deactivate(struct ub_event *ub_ev) if (ev->events & UB_EV_TIMEOUT) { DEBUG4("unbound event %p - Disarming timeout", ev); - if (!fr_cond_assert_msg(fr_timer_disarm(ev->timer) == 0, "failed disarming timeout")) { + if (!fr_cond_assert_msg(fr_timer_disarm(ev->timer_ev) == 0, "failed disarming timeout")) { ret = -1; } } @@ -379,7 +379,7 @@ static int _unbound_io_timer_modify(struct ub_event *ub_ev, UNUSED struct ub_eve ev, uctx, ev->uctx); ev->uctx = uctx; } - if (!fr_cond_assert_msg(fr_timer_disarm(ev->timer) == 0, "ubound event %p - Failed disarming timeout", ev)) { + if (!fr_cond_assert_msg(fr_timer_disarm(ev->timer_ev) == 0, "ubound event %p - Failed disarming timeout", ev)) { ret = -1; /* Continue ? */ } @@ -387,7 +387,7 @@ static int _unbound_io_timer_modify(struct ub_event *ub_ev, UNUSED struct ub_eve DEBUG4("unbound event %p - Timeout in %pV seconds", ev, fr_box_time_delta(timeout)); - if (fr_timer_in(ev, ev->ev_b->el->tl, &ev->timer, + if (fr_timer_in(ev, ev->ev_b->el->tl, &ev->timer_ev, timeout, false, _unbound_io_service_timer_expired, ev) < 0) { PERROR("unbound event %p - Failed adding timeout", ev); @@ -409,7 +409,7 @@ static int _unbound_io_timer_deactivate(struct ub_event *ub_ev) DEBUG4("unbound event %p - Disarming timeout", ev); - if (!fr_cond_assert_msg(fr_timer_disarm(ev->timer) == 0, "failed disarming timeout")) return -1; + if (!fr_cond_assert_msg(fr_timer_disarm(ev->timer_ev) == 0, "failed disarming timeout")) return -1; return 0; }