aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-02-19 18:56:47 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-02-27 12:52:14 +0100
commitaf303fdbff4910454de3414f47c1345a6d01065a (patch)
treef3266e95b9c574fcf54a9a4174de0c741798f75b /tcp.c
parent4e08d9b9c6289ee00687203ce7a08106e9d45dc6 (diff)
downloadpasst-af303fdbff4910454de3414f47c1345a6d01065a.tar
passt-af303fdbff4910454de3414f47c1345a6d01065a.tar.gz
passt-af303fdbff4910454de3414f47c1345a6d01065a.tar.bz2
passt-af303fdbff4910454de3414f47c1345a6d01065a.tar.lz
passt-af303fdbff4910454de3414f47c1345a6d01065a.tar.xz
passt-af303fdbff4910454de3414f47c1345a6d01065a.tar.zst
passt-af303fdbff4910454de3414f47c1345a6d01065a.zip
tcp: Don't stop refilling socket pool if we find a filled entry
Currently tcp_sock_refill_pool() stops as soon as it finds an entry in the pool with a valid fd. This appears to makes sense: we always use fds from the front of the pool, so if we find a filled one, the rest of the pool should be filled as well. However, that's not quite correct. If a previous refill hit errors trying to open new sockets, it could leave gaps between blocks of valid fds. We're going to add some changes that could make that more likely. So, for robustness, instead skip over the filled entry but still try to refill the rest of the array. We expect simply iterating over the pool to be of small cost compared to even a single system call, so this shouldn't have much impact. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index 74a3e31..9eec9f3 100644
--- a/tcp.c
+++ b/tcp.c
@@ -3014,7 +3014,7 @@ void tcp_sock_refill_pool(const struct ctx *c, int pool[], sa_family_t af)
for (i = 0; i < TCP_SOCK_POOL_SIZE; i++) {
if (pool[i] >= 0)
- break;
+ continue;
pool[i] = tcp_conn_new_sock(c, af);
}