diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-02-16 16:43:09 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-02-16 18:56:31 +0100 |
commit | 42bfd212b1f3bb52c7781bea10022e1c1d9db5fc (patch) | |
tree | a9787376e34dad23d09c92abd973ca1240827af7 /tap.c | |
parent | b62ed9ca0e85a3e779deb1207033f25b0a2a9729 (diff) | |
download | passt-42bfd212b1f3bb52c7781bea10022e1c1d9db5fc.tar passt-42bfd212b1f3bb52c7781bea10022e1c1d9db5fc.tar.gz passt-42bfd212b1f3bb52c7781bea10022e1c1d9db5fc.tar.bz2 passt-42bfd212b1f3bb52c7781bea10022e1c1d9db5fc.tar.lz passt-42bfd212b1f3bb52c7781bea10022e1c1d9db5fc.tar.xz passt-42bfd212b1f3bb52c7781bea10022e1c1d9db5fc.tar.zst passt-42bfd212b1f3bb52c7781bea10022e1c1d9db5fc.zip |
tap: Eliminate goto from tap_handler()
The goto here really doesn't improve clarity or brevity at all. Use a
clearer construct.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.c')
-rw-r--r-- | tap.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -1229,18 +1229,13 @@ void tap_handler(struct ctx *c, int fd, uint32_t events, } if ((c->mode == MODE_PASST && tap_handler_passt(c, now)) || - (c->mode == MODE_PASTA && tap_handler_pasta(c, now))) - goto reinit; - - if (events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR)) - goto reinit; + (c->mode == MODE_PASTA && tap_handler_pasta(c, now)) || + (events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR))) { + if (c->one_off) { + info("Client closed connection, exiting"); + exit(EXIT_SUCCESS); + } - return; -reinit: - if (c->one_off) { - info("Client closed connection, exiting"); - exit(EXIT_SUCCESS); + tap_sock_init(c); } - - tap_sock_init(c); } |