diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-10-05 17:28:43 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-12-12 16:44:57 +0100 |
commit | 7d83e139378ec25a8a69146784af5227fbe25b4f (patch) | |
tree | 023ef7b95af6d18dbdcebf00ab5581e8b5e8daee /zebra | |
parent | zebra: Add `zrouter.asic_notification_nexthop_control` (diff) | |
download | frr-7d83e139378ec25a8a69146784af5227fbe25b4f.tar.xz frr-7d83e139378ec25a8a69146784af5227fbe25b4f.zip |
zebra: Re-arrange fpm_read to reduce code duplication
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/dplane_fpm_nl.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 6c95be29d..8bbafdd5c 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -467,13 +467,6 @@ static void fpm_read(struct thread *t) /* Let's ignore the input at the moment. */ rv = stream_read_try(fnc->ibuf, fnc->socket, STREAM_WRITEABLE(fnc->ibuf)); - /* We've got an interruption. */ - if (rv == -2) { - /* Schedule next read. */ - thread_add_read(fnc->fthread->master, fpm_read, fnc, - fnc->socket, &fnc->t_read); - return; - } if (rv == 0) { atomic_fetch_add_explicit(&fnc->counters.connection_closes, 1, memory_order_relaxed); @@ -492,14 +485,20 @@ static void fpm_read(struct thread *t) FPM_RECONNECT(fnc); return; } + + /* Schedule the next read */ + thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, + &fnc->t_read); + + /* We've got an interruption. */ + if (rv == -2) + return; + stream_reset(fnc->ibuf); /* Account all bytes read. */ atomic_fetch_add_explicit(&fnc->counters.bytes_read, rv, memory_order_relaxed); - - thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, - &fnc->t_read); } static void fpm_write(struct thread *t) |