]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_io.c
*: Change thread->func to return void instead of int
[mirror_frr.git] / bgpd / bgp_io.c
index e9b0f9e46a103f41ca03b96663a0ed2bb2720473..bd0dfb3a6dd9388078022c3a5d866233bf158db1 100644 (file)
@@ -45,8 +45,8 @@
 /* forward declarations */
 static uint16_t bgp_write(struct peer *);
 static uint16_t bgp_read(struct peer *peer, int *code_p);
-static int bgp_process_writes(struct thread *);
-static int bgp_process_reads(struct thread *);
+static void bgp_process_writes(struct thread *);
+static void bgp_process_reads(struct thread *);
 static bool validate_header(struct peer *);
 
 /* generic i/o status codes */
@@ -111,6 +111,7 @@ void bgp_reads_off(struct peer *peer)
 
        thread_cancel_async(fpt->master, &peer->t_read, NULL);
        THREAD_OFF(peer->t_process_packet);
+       THREAD_OFF(peer->t_process_packet_error);
 
        UNSET_FLAG(peer->thread_flags, PEER_THREAD_READS_ON);
 }
@@ -120,7 +121,7 @@ void bgp_reads_off(struct peer *peer)
 /*
  * Called from I/O pthread when a file descriptor has become ready for writing.
  */
-static int bgp_process_writes(struct thread *thread)
+static void bgp_process_writes(struct thread *thread)
 {
        static struct peer *peer;
        peer = THREAD_ARG(thread);
@@ -129,7 +130,7 @@ static int bgp_process_writes(struct thread *thread)
        bool fatal = false;
 
        if (peer->fd < 0)
-               return -1;
+               return;
 
        struct frr_pthread *fpt = bgp_pth_io;
 
@@ -160,8 +161,6 @@ static int bgp_process_writes(struct thread *thread)
                BGP_UPDATE_GROUP_TIMER_ON(&peer->t_generate_updgrp_packets,
                                          bgp_generate_updgrp_packets);
        }
-
-       return 0;
 }
 
 /*
@@ -171,7 +170,7 @@ static int bgp_process_writes(struct thread *thread)
  * We read as much data as possible, process as many packets as we can and
  * place them on peer->ibuf for secondary processing by the main thread.
  */
-static int bgp_process_reads(struct thread *thread)
+static void bgp_process_reads(struct thread *thread)
 {
        /* clang-format off */
        static struct peer *peer;       // peer to read from
@@ -185,7 +184,7 @@ static int bgp_process_reads(struct thread *thread)
        peer = THREAD_ARG(thread);
 
        if (peer->fd < 0 || bm->terminating)
-               return -1;
+               return;
 
        struct frr_pthread *fpt = bgp_pth_io;
 
@@ -208,7 +207,7 @@ static int bgp_process_reads(struct thread *thread)
                 * specific state change from 'bgp_read'.
                 */
                thread_add_event(bm->master, bgp_packet_process_error,
-                                peer, code, NULL);
+                                peer, code, &peer->t_process_packet_error);
        }
 
        while (more) {
@@ -270,8 +269,6 @@ static int bgp_process_reads(struct thread *thread)
                        thread_add_event(bm->master, bgp_process_packet,
                                         peer, 0, &peer->t_process_packet);
        }
-
-       return 0;
 }
 
 /*