[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quagga-dev
Subject:    [quagga-dev 574] ISISd in CVS
From:       Hasso Tepper <hasso () estpak ! ee>
Date:       2003-12-23 12:33:49
[Download RAW message or body]

Vincent Jardin commited ISISd to CVS. I commited some fixes made by me 
and Cougar as well. I left out one patch made by Cougar which needs 
discussion IMHO. Patch is attached. 

It replaces thread_cancel and thread_add_timer respectively by 
THREAD_OFF and THREAD_TIMER_ON. No question IMHO - code is shorter 
etc, but at the moment THREAD_TIMER_ON is used only in one place in 
bgpd and THREAD_OFF isn't used at all.

Why? Another good(?) idea implemented in lib/ which just isn't used?


-- 
Hasso Tepper
Elion Enterprises Ltd.
WAN administrator

["isis-dr.c.patch" (text/x-diff)]

Index: isis_dr.c
===================================================================
RCS file: /cvsroot/zebra-isis/isisd/isis_dr.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -p -r1.2 -r1.3
--- isis_dr.c	15 May 2003 14:14:13 -0000	1.2
+++ isis_dr.c	20 May 2003 08:57:18 -0000	1.3
@@ -239,14 +239,10 @@ isis_dr_resign (struct isis_circuit *cir
 
   circuit->u.bc.is_dr[level - 1] = 0;
   circuit->u.bc.run_dr_elect[level - 1] = 0; 
-  if (circuit->u.bc.t_run_dr[level - 1]) {
-    thread_cancel (circuit->u.bc.t_run_dr[level - 1]);
-    circuit->u.bc.t_run_dr[level - 1] = NULL;
-  }
-  if (circuit->u.bc.t_refresh_pseudo_lsp[level - 1]) {
-    thread_cancel (circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
-    circuit->u.bc.t_refresh_pseudo_lsp[level - 1] = NULL;
-  }
+  if (circuit->u.bc.t_run_dr[level - 1])
+    THREAD_OFF(circuit->u.bc.t_run_dr[level - 1]);
+  if (circuit->u.bc.t_refresh_pseudo_lsp[level - 1])
+    THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]);
   
   memcpy (id, isis->sysid, ISIS_SYS_ID_LEN);
   LSP_PSEUDO_ID(id) = circuit->circuit_id;
@@ -255,35 +251,22 @@ isis_dr_resign (struct isis_circuit *cir
 
   if (level == 1) {
     memset (circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1);
-    
-    if (circuit->t_send_csnp[0])
-      thread_cancel (circuit->t_send_csnp[0]);    
-    
-    circuit->u.bc.t_run_dr[0] =
-      thread_add_timer (master, isis_run_dr_l1, circuit,
-                        2 * circuit->hello_interval[1]);    
-
-    circuit->t_send_psnp[0] = 
-      thread_add_timer (master,
-                        send_l1_psnp,
-                        circuit,
-                        isis_jitter (circuit->psnp_interval[level - 1],
-                                     PSNP_JITTER));
+
+    THREAD_OFF(circuit->t_send_csnp[0]);
+    THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
+                    circuit, 2 * circuit->hello_interval[1]);
+    THREAD_TIMER_ON(master, circuit->t_send_psnp[0], send_l1_psnp,
+                    circuit, isis_jitter (circuit->psnp_interval[level - 1],
+                                          PSNP_JITTER));
   } else {
     memset (circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1);
 
-    if (circuit->t_send_csnp[0])
-      thread_cancel (circuit->t_send_csnp[0]);
-
-    circuit->u.bc.t_run_dr[1] =
-      thread_add_timer (master, isis_run_dr_l2, circuit,
-                        2 * circuit->hello_interval[1]);    
-    circuit->t_send_psnp[1] = 
-      thread_add_timer (master,
-                        send_l2_psnp,
-                        circuit,
-                        isis_jitter (circuit->psnp_interval[level - 1],
-                                     PSNP_JITTER));
+    THREAD_OFF(circuit->t_send_csnp[0]);
+    THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
+                    circuit, 2 * circuit->hello_interval[1]);
+    THREAD_TIMER_ON(master, circuit->t_send_psnp[1], send_l2_psnp,
+                    circuit, isis_jitter (circuit->psnp_interval[level - 1],
+                                          PSNP_JITTER));
   }
   
   thread_add_event (master, isis_event_dis_status_change, circuit, 0);
@@ -301,15 +284,13 @@ isis_dr_commence (struct isis_circuit *c
   /* Lets keep a pause in DR election */
   circuit->u.bc.run_dr_elect[level - 1] = 0;
   if (level == 1) 
-    circuit->u.bc.t_run_dr[0] = 
-      thread_add_timer (master, isis_run_dr_l1, circuit,
-			2 * circuit->hello_multiplier[0] * 
-			circuit->hello_interval[0]); 
+    THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
+                    circuit, 2 * circuit->hello_multiplier[0] *
+                    circuit->hello_interval[0]);
   else 
-    circuit->u.bc.t_run_dr[1] = 
-      thread_add_timer (master, isis_run_dr_l2, circuit,
-			2 * circuit->hello_multiplier[1] * 
-			circuit->hello_interval[1]);	      	
+    THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
+                    circuit, 2 * circuit->hello_multiplier[1] *
+                    circuit->hello_interval[1]);
   circuit->u.bc.is_dr[level - 1] = 1;
 
   if (level == 1) {
@@ -327,16 +308,11 @@ isis_dr_commence (struct isis_circuit *c
           thread_cancel (circuit->t_send_l1_psnp); */
     lsp_l1_pseudo_generate (circuit);
 
-    circuit->u.bc.t_run_dr[0] =
-      thread_add_timer (master, isis_run_dr_l1, circuit,
-                        2 * circuit->hello_interval[0]);
-
-    circuit->t_send_csnp[0] = thread_add_timer (master,
-                                                send_l1_csnp,
-                                                circuit, 
-                                                isis_jitter 
-                                              (circuit->csnp_interval[level-1],
-                                               CSNP_JITTER));
+    THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[0], isis_run_dr_l1,
+                    circuit, 2 * circuit->hello_interval[0]);
+    THREAD_TIMER_ON(master, circuit->t_send_csnp[0], send_l1_csnp,
+                    circuit, isis_jitter(circuit->csnp_interval[level-1],
+                                         CSNP_JITTER));
   } else {
     memcpy (old_dr, circuit->u.bc.l2_desig_is, ISIS_SYS_ID_LEN + 1);
     LSP_FRAGMENT (old_dr) = 0;
@@ -352,17 +328,11 @@ isis_dr_commence (struct isis_circuit *c
           thread_cancel (circuit->t_send_l1_psnp); */
     lsp_l2_pseudo_generate (circuit);
 
-    circuit->u.bc.t_run_dr[1] =
-      thread_add_timer (master, isis_run_dr_l2, circuit,
-                        2 * circuit->hello_interval[1]);    
-
-    circuit->t_send_csnp[1] = 
-      thread_add_timer (master,
-                        send_l2_csnp,
-                        circuit, 
-                        isis_jitter (circuit->csnp_interval[level-1],
-                                     CSNP_JITTER));
-        
+    THREAD_TIMER_ON(master, circuit->u.bc.t_run_dr[1], isis_run_dr_l2,
+                    circuit, 2 * circuit->hello_interval[1]);
+    THREAD_TIMER_ON(master, circuit->t_send_csnp[1], send_l2_csnp,
+                    circuit, isis_jitter (circuit->csnp_interval[level-1],
+                                          CSNP_JITTER));
   } 
 
   thread_add_event (master, isis_event_dis_status_change, circuit, 0);


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
http://lists.quagga.net/mailman/listinfo/quagga-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic