Skip to content

Commit 7d83e13

Browse files
committed
zebra: Re-arrange fpm_read to reduce code duplication
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
1 parent 06525c4 commit 7d83e13

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

zebra/dplane_fpm_nl.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,6 @@ static void fpm_read(struct thread *t)
467467
/* Let's ignore the input at the moment. */
468468
rv = stream_read_try(fnc->ibuf, fnc->socket,
469469
STREAM_WRITEABLE(fnc->ibuf));
470-
/* We've got an interruption. */
471-
if (rv == -2) {
472-
/* Schedule next read. */
473-
thread_add_read(fnc->fthread->master, fpm_read, fnc,
474-
fnc->socket, &fnc->t_read);
475-
return;
476-
}
477470
if (rv == 0) {
478471
atomic_fetch_add_explicit(&fnc->counters.connection_closes, 1,
479472
memory_order_relaxed);
@@ -492,14 +485,20 @@ static void fpm_read(struct thread *t)
492485
FPM_RECONNECT(fnc);
493486
return;
494487
}
488+
489+
/* Schedule the next read */
490+
thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket,
491+
&fnc->t_read);
492+
493+
/* We've got an interruption. */
494+
if (rv == -2)
495+
return;
496+
495497
stream_reset(fnc->ibuf);
496498

497499
/* Account all bytes read. */
498500
atomic_fetch_add_explicit(&fnc->counters.bytes_read, rv,
499501
memory_order_relaxed);
500-
501-
thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket,
502-
&fnc->t_read);
503502
}
504503

505504
static void fpm_write(struct thread *t)

0 commit comments

Comments
 (0)