tcp: Don't store errnos in socket pool
If tcp_sock_refill_pool() gets an error opening new sockets, it stores the negative errno of that error in the socket pool. This isn't especially useful: * It's inconsistent with the initial state of the pool (all -1) * It's inconsistent with the state of an entry that was valid and was then consumed (also -1) * By the time we did anything with this error code, it's now far removed from the situation in which the error occurred, making it difficult to report usefully We now have error reporting closer to when failures happen on the refill paths, so just leave a pool slot we can't fill as -1. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
fe27ebce5c
commit
e5e6f29459
1 changed files with 6 additions and 2 deletions
8
tcp.c
8
tcp.c
|
@ -3039,11 +3039,15 @@ int tcp_sock_refill_pool(const struct ctx *c, int pool[], sa_family_t af)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < TCP_SOCK_POOL_SIZE; i++) {
|
for (i = 0; i < TCP_SOCK_POOL_SIZE; i++) {
|
||||||
|
int fd;
|
||||||
|
|
||||||
if (pool[i] >= 0)
|
if (pool[i] >= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((pool[i] = tcp_conn_new_sock(c, af)) < 0)
|
if ((fd = tcp_conn_new_sock(c, af)) < 0)
|
||||||
return pool[i];
|
return fd;
|
||||||
|
|
||||||
|
pool[i] = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue