]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: only perform shutdown signal processing once 2946/head
authorMark Stapp <mjs@voltanet.io>
Mon, 15 Oct 2018 15:14:07 +0000 (11:14 -0400)
committerMark Stapp <mjs@voltanet.io>
Thu, 25 Oct 2018 12:57:04 +0000 (08:57 -0400)
Avoid running the shutdown/sigint handler code more than once. With
the async dataplane, once shutdown has been initiated, the completion
of all async updates triggers final shutdown of the zebra main
pthread. During that time, avoid taking and processing a second
signal, such as SIGINT or SIGTERM.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/main.c

index 955ab0445e99fc9831bd9cd9b61ab3eebd9ff10f..253b3087fbf8a88899d62e2070ce0abb6ec2b21d 100644 (file)
@@ -142,6 +142,12 @@ static void sigint(void)
        struct zebra_vrf *zvrf;
        struct listnode *ln, *nn;
        struct zserv *client;
+       static bool sigint_done;
+
+       if (sigint_done)
+               return;
+
+       sigint_done = true;
 
        zlog_notice("Terminating on signal");
 
@@ -174,11 +180,17 @@ static void sigint(void)
 
        list_delete(&zebrad.client_list);
 
-       /* Indicate that all new dplane work has been enqueued */
+       /* Indicate that all new dplane work has been enqueued. When that
+        * work is complete, the dataplane will enqueue an event
+        * with the 'finalize' function.
+        */
        zebra_dplane_finish();
 }
 
-/* TODO */
+/*
+ * Final shutdown step for the zebra main thread. This is run after all
+ * async update processing has completed.
+ */
 int zebra_finalize(struct thread *dummy)
 {
        zlog_info("Zebra final shutdown");