From: Quentin Young Date: Tue, 7 Nov 2017 07:49:54 +0000 (-0500) Subject: bgpd: schedule process packet as timer X-Git-Tag: frr-4.0-dev~120^2~8 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=4af766600a3dc8779f09070c500ba0465eed74de;p=matthieu%2Ffrr.git 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. --- 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); }