]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: use a smaller #ifdef for isis_receive()
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 28 Nov 2016 20:35:36 +0000 (18:35 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 28 Nov 2016 20:59:13 +0000 (18:59 -0200)
There's no need to provide two definitions of the isis_receive()
function (one for GNU_LINUX and the other for !GNU_LINUX). Both differ
only slightly so it makes more sense to define isis_receive() just once
and use a smaller #ifdef to account for these differences. This improves
code readability.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
isisd/isis_pdu.c

index 1dfb4623f67cadeaf5b593232b3d7856c71aee39..39d2df74b6566d66c1c4e98735fd1cad833be2bd 100644 (file)
@@ -2139,7 +2139,6 @@ isis_handle_pdu (struct isis_circuit *circuit, u_char * ssnpa)
   return retval;
 }
 
-#ifdef GNU_LINUX
 int
 isis_receive (struct thread *thread)
 {
@@ -2153,10 +2152,11 @@ isis_receive (struct thread *thread)
   circuit = THREAD_ARG (thread);
   assert (circuit);
 
+  circuit->t_read = NULL;
+
   isis_circuit_stream(circuit, &circuit->rcv_stream);
 
   retval = circuit->rx (circuit, ssnpa);
-  circuit->t_read = NULL;
 
   if (retval == ISIS_OK)
     retval = isis_handle_pdu (circuit, ssnpa);
@@ -2166,52 +2166,20 @@ isis_receive (struct thread *thread)
    */
   if (!circuit->is_passive)
   {
+#ifdef GNU_LINUX
     THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit,
                     circuit->fd);
-  }
-
-  return retval;
-}
-
 #else
-int
-isis_receive (struct thread *thread)
-{
-  struct isis_circuit *circuit;
-  u_char ssnpa[ETH_ALEN];
-  int retval;
-
-  /*
-   * Get the circuit 
-   */
-  circuit = THREAD_ARG (thread);
-  assert (circuit);
-
-  circuit->t_read = NULL;
-
-  isis_circuit_stream(circuit, &circuit->rcv_stream);
-
-  retval = circuit->rx (circuit, ssnpa);
-
-  if (retval == ISIS_OK)
-    retval = isis_handle_pdu (circuit, ssnpa);
-
-  /* 
-   * prepare for next packet. 
-   */
-  if (!circuit->is_passive)
-  {
     circuit->t_read = thread_add_timer_msec (master, isis_receive, circuit,
                                             listcount
                                             (circuit->area->circuit_list) *
                                             100);
+#endif
   }
 
   return retval;
 }
 
-#endif
-
  /* filling of the fixed isis header */
 void
 fill_fixed_hdr (struct isis_fixed_hdr *hdr, u_char pdu_type)