diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-03-25 11:24:23 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-03-29 15:35:38 +0200 |
commit | 415ccf6116c496aab173ee9548089fe69ccf8f5f (patch) | |
tree | 1d8a64b7490f06539b2f1f7f55b840568dddfc63 /tcp.c | |
parent | f41f0416b837925bc8612f45ca58432218ce6707 (diff) | |
download | passt-415ccf6116c496aab173ee9548089fe69ccf8f5f.tar passt-415ccf6116c496aab173ee9548089fe69ccf8f5f.tar.gz passt-415ccf6116c496aab173ee9548089fe69ccf8f5f.tar.bz2 passt-415ccf6116c496aab173ee9548089fe69ccf8f5f.tar.lz passt-415ccf6116c496aab173ee9548089fe69ccf8f5f.tar.xz passt-415ccf6116c496aab173ee9548089fe69ccf8f5f.tar.zst passt-415ccf6116c496aab173ee9548089fe69ccf8f5f.zip |
tcp, tcp_splice: Use less awkward syntax to swap in/out sockets from pools
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -2031,13 +2031,12 @@ static uint32_t tcp_seq_init(struct ctx *c, int af, void *addr, */ static int tcp_conn_new_sock(struct ctx *c, sa_family_t af) { - int *pool = af == AF_INET6 ? init_sock_pool6 : init_sock_pool4, i, s; + int *p = af == AF_INET6 ? init_sock_pool6 : init_sock_pool4, i, s = -1; - for (i = 0; i < TCP_SOCK_POOL_SIZE; i++, pool++) { - if ((s = *pool) >= 0) { - *pool = -1; + for (i = 0; i < TCP_SOCK_POOL_SIZE; i++, p++) { + SWAP(s, *p); + if (s >= 0) break; - } } if (s < 0) |