1
0
mirror of https://passt.top/passt synced 2024-07-04 08:52:40 +00:00

tcp: Stop on first error when refilling socket pools

Currently if we get an error opening a new socket while refilling a socket
pool, we carry on to the next slot and try again.  This isn't very useful,
since by far the most likely cause of an error is some sort of resource
exhaustion.  Trying again will probably just hit the same error, and maybe
even make things worse.

So, instead stop on the first error while refilling the pool, making do
with however many sockets we managed to open before the error.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2024-02-19 18:56:48 +11:00 committed by Stefano Brivio
parent af303fdbff
commit 554b3aefe7

3
tcp.c
View File

@ -3016,7 +3016,8 @@ void tcp_sock_refill_pool(const struct ctx *c, int pool[], sa_family_t af)
if (pool[i] >= 0)
continue;
pool[i] = tcp_conn_new_sock(c, af);
if ((pool[i] = tcp_conn_new_sock(c, af)) < 0)
break;
}
}