From 4aec430ce30fc63b6da8f4fa0223e58322989274 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 7 Sep 2023 09:46:06 -0400 Subject: [PATCH] bgpd: Remove BGP_EVENT_FLUSH and just use event_cancel_event_ready The usage of BGP_EVENT_FLUSH is unnecessarily abstracting the call into event_cancel_event_ready and in addtion the macro was not always being used! Just convert to using the actual event_cancel_event_ready function directly. Signed-off-by: Donald Sharp --- bgpd/bgp_fsm.c | 4 ++-- bgpd/bgp_fsm.h | 6 ------ bgpd/bgpd.c | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 786e953843..c726f3c4fa 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1351,7 +1351,7 @@ bgp_clearing_completed(struct peer_connection *connection) enum bgp_fsm_state_progress rc = bgp_stop(connection); if (rc >= BGP_FSM_SUCCESS) - BGP_EVENT_FLUSH(peer); + event_cancel_event_ready(bm->master, peer); return rc; } @@ -1387,7 +1387,7 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection) /* Can't do this in Clearing; events are used for state transitions */ if (connection->status != Clearing) { /* Delete all existing events of the peer */ - BGP_EVENT_FLUSH(peer); + event_cancel_event_ready(bm->master, peer); } /* Increment Dropped count. */ diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h index 1f53ac6118..0a36e0009e 100644 --- a/bgpd/bgp_fsm.h +++ b/bgpd/bgp_fsm.h @@ -27,12 +27,6 @@ enum bgp_fsm_state_progress { event_add_event(bm->master, bgp_event, (P), (E), NULL); \ } while (0) -#define BGP_EVENT_FLUSH(P) \ - do { \ - assert(peer); \ - event_cancel_event_ready(bm->master, (P)); \ - } while (0) - #define BGP_UPDATE_GROUP_TIMER_ON(T, F) \ do { \ if (BGP_SUPPRESS_FIB_ENABLED(peer->bgp) && \ diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 60b394b697..29ecab5dd4 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1212,7 +1212,7 @@ static void peer_free(struct peer *peer) EVENT_OFF(peer->t_revalidate_all[afi][safi]); assert(!peer->connection->t_write); assert(!peer->connection->t_read); - BGP_EVENT_FLUSH(peer); + event_cancel_event_ready(bm->master, peer); /* Free connected nexthop, if present */ if (CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE) -- 2.39.5