From b2e366d87bf8b340fe5e0b0186369cda7a94d186 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 5 Feb 2021 15:41:27 +0100 Subject: tests/echo_srv: allow more than once tcp connection at a time We should not wait for the last connection to disconnect, there would not be any reason to use fork at all. Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- tests/echo_srv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/echo_srv.c b/tests/echo_srv.c index 0aefa9a..fbb6637 100644 --- a/tests/echo_srv.c +++ b/tests/echo_srv.c @@ -537,6 +537,7 @@ static void echo_tcp(int sock) pid_t pid; while (1) { + waitpid(-1, NULL, WNOHANG); s = accept(sock, &addr.sa.s, &addr.sa_socklen); if (s == -1 && errno == ECONNABORTED) { continue; @@ -575,7 +576,6 @@ static void echo_tcp(int sock) close(s); exit(0); } - waitpid(-1, NULL, 0); close(s); } -- cgit