]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: schedule process packet as timer
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 7 Nov 2017 07:49:54 +0000 (02:49 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 30 Nov 2017 21:18:06 +0000 (16:18 -0500)
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

index b28612922fbb0f447e30ff8f8b53872b5e1a2ecd..42ca87679f169a0d1058edff9a1514e3f926349c 100644 (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);
        }