From 67187f620b2a08476b3a98020658cba71dd3d3d9 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 21 Jun 2024 18:08:01 +0200 Subject: [PATCH] samples: net: sockets: echo_client/server: Bump ZVFS_OPEN_MAX config Recent POSIX changes caused that 3 file descriptors are now preallocated for stdin/out/err. This caused file descriptor shortage in all-in TLS configuration of the sample, hence increase the maximum FD count. In the server sample this manifested itself as an accept() error. This triggered a busy loop though in the sample, as in case of accept() errors it'd just try again w/o any delay. This made this issue hard to investigate, so to avoid such cases in the future, make the accept() failure fatal in the echo_server sample. Signed-off-by: Robert Lubos --- samples/net/sockets/echo_client/overlay-tls.conf | 2 +- samples/net/sockets/echo_server/overlay-tls.conf | 2 +- samples/net/sockets/echo_server/src/tcp.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/net/sockets/echo_client/overlay-tls.conf b/samples/net/sockets/echo_client/overlay-tls.conf index 848f323b5b3..c807e9a1c95 100644 --- a/samples/net/sockets/echo_client/overlay-tls.conf +++ b/samples/net/sockets/echo_client/overlay-tls.conf @@ -13,4 +13,4 @@ CONFIG_NET_SOCKETS_SOCKOPT_TLS=y CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=4 CONFIG_NET_SOCKETS_ENABLE_DTLS=y CONFIG_NET_SOCKETS_DTLS_MAX_FRAGMENT_LENGTH=2048 -CONFIG_ZVFS_OPEN_MAX=8 +CONFIG_ZVFS_OPEN_MAX=12 diff --git a/samples/net/sockets/echo_server/overlay-tls.conf b/samples/net/sockets/echo_server/overlay-tls.conf index 7ddcb640e71..f2351c0ecc8 100644 --- a/samples/net/sockets/echo_server/overlay-tls.conf +++ b/samples/net/sockets/echo_server/overlay-tls.conf @@ -14,4 +14,4 @@ CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=6 CONFIG_NET_SOCKETS_ENABLE_DTLS=y CONFIG_NET_SOCKETS_DTLS_TIMEOUT=30000 CONFIG_NET_SOCKETS_DTLS_MAX_FRAGMENT_LENGTH=2048 -CONFIG_ZVFS_OPEN_MAX=16 +CONFIG_ZVFS_OPEN_MAX=20 diff --git a/samples/net/sockets/echo_server/src/tcp.c b/samples/net/sockets/echo_server/src/tcp.c index c9d5cc68ebd..310decddae4 100644 --- a/samples/net/sockets/echo_server/src/tcp.c +++ b/samples/net/sockets/echo_server/src/tcp.c @@ -236,7 +236,7 @@ static int process_tcp(struct data *data) &client_addr_len); if (client < 0) { LOG_ERR("%s accept error (%d)", data->proto, -errno); - return 0; + return -errno; } slot = get_free_slot(data);