diff options
Diffstat (limited to 'lib/zclient.c')
-rw-r--r-- | lib/zclient.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index ab2dd0989..cfccb2166 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -263,20 +263,21 @@ static enum zclient_send_status zclient_failed(struct zclient *zclient) return ZCLIENT_SEND_FAILURE; } -static int zclient_flush_data(struct thread *thread) +static void zclient_flush_data(struct thread *thread) { struct zclient *zclient = THREAD_ARG(thread); zclient->t_write = NULL; if (zclient->sock < 0) - return -1; + return; switch (buffer_flush_available(zclient->wb, zclient->sock)) { case BUFFER_ERROR: flog_err( EC_LIB_ZAPI_SOCKET, "%s: buffer_flush_available failed on zclient fd %d, closing", __func__, zclient->sock); - return zclient_failed(zclient); + zclient_failed(zclient); + return; case BUFFER_PENDING: zclient->t_write = NULL; thread_add_write(zclient->master, zclient_flush_data, zclient, @@ -287,7 +288,6 @@ static int zclient_flush_data(struct thread *thread) (*zclient->zebra_buffer_write_ready)(); break; } - return 0; } /* @@ -754,7 +754,7 @@ void zclient_init(struct zclient *zclient, int redist_default, /* This function is a wrapper function for calling zclient_start from timer or event thread. */ -static int zclient_connect(struct thread *t) +static void zclient_connect(struct thread *t) { struct zclient *zclient; @@ -764,7 +764,7 @@ static int zclient_connect(struct thread *t) if (zclient_debug) zlog_debug("zclient_connect is called"); - return zclient_start(zclient); + zclient_start(zclient); } enum zclient_send_status zclient_send_rnh(struct zclient *zclient, int command, @@ -3864,7 +3864,7 @@ static zclient_handler *const lib_handlers[] = { }; /* Zebra client message read function. */ -static int zclient_read(struct thread *thread) +static void zclient_read(struct thread *thread) { size_t already; uint16_t length, command; @@ -3888,11 +3888,12 @@ static int zclient_read(struct thread *thread) zlog_debug( "zclient connection closed socket [%d].", zclient->sock); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } if (nbyte != (ssize_t)(ZEBRA_HEADER_SIZE - already)) { zclient_event(ZCLIENT_READ, zclient); - return 0; + return; } already = ZEBRA_HEADER_SIZE; } @@ -3912,14 +3913,16 @@ static int zclient_read(struct thread *thread) EC_LIB_ZAPI_MISSMATCH, "%s: socket %d version mismatch, marker %d, version %d", __func__, zclient->sock, marker, version); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } if (length < ZEBRA_HEADER_SIZE) { flog_err(EC_LIB_ZAPI_MISSMATCH, "%s: socket %d message length %u is less than %d ", __func__, zclient->sock, length, ZEBRA_HEADER_SIZE); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } /* Length check. */ @@ -3947,12 +3950,13 @@ static int zclient_read(struct thread *thread) zlog_debug( "zclient connection closed socket [%d].", zclient->sock); - return zclient_failed(zclient); + zclient_failed(zclient); + return; } if (nbyte != (ssize_t)(length - already)) { /* Try again later. */ zclient_event(ZCLIENT_READ, zclient); - return 0; + return; } } @@ -3969,13 +3973,11 @@ static int zclient_read(struct thread *thread) if (zclient->sock < 0) /* Connection was closed during packet processing. */ - return -1; + return; /* Register read thread. */ stream_reset(zclient->ibuf); zclient_event(ZCLIENT_READ, zclient); - - return 0; } void zclient_redistribute(int command, struct zclient *zclient, afi_t afi, |