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.
This commit is contained in:
Quentin Young 2017-11-07 02:49:54 -05:00
parent af1e1dc69e
commit 4af766600a
No known key found for this signature in database
GPG Key ID: DAF48E0F57E0834F

View File

@ -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);
}