From 4af766600a3dc8779f09070c500ba0465eed74de Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 7 Nov 2017 02:49:54 -0500 Subject: [PATCH] bgpd: schedule process packet as timer Different places scheduling the same thread should use the same semantics and thread type. Additionally providing the back reference here makes sure we only schedule the job once and avoids flooding the event queue with jobs to process an empty buffer. --- bgpd/bgp_packet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index b28612922f..42ca87679f 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2270,8 +2270,9 @@ int bgp_process_packet(struct thread *thread) { // more work to do, come back later if (peer->ibuf->count > 0) - thread_add_event(bm->master, bgp_process_packet, - peer, 0, NULL); + thread_add_timer_msec( + bm->master, bgp_process_packet, peer, 0, + &peer->t_process_packet); } pthread_mutex_unlock(&peer->io_mtx); } -- 2.39.5