summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-02-05 15:41:27 +0100
committerAndreas Schneider <asn@samba.org>2021-02-08 19:29:57 +0100
commitb2e366d87bf8b340fe5e0b0186369cda7a94d186 (patch)
treee16f65dab32c94af71cb606be5a0dd6f6ed8e7e2
parente896cecf1fc08d091d09fa29f1cfbfc22dab89ff (diff)
downloadsocket_wrapper-b2e366d87bf8b340fe5e0b0186369cda7a94d186.tar.gz
socket_wrapper-b2e366d87bf8b340fe5e0b0186369cda7a94d186.tar.xz
socket_wrapper-b2e366d87bf8b340fe5e0b0186369cda7a94d186.zip
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 <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--tests/echo_srv.c2
1 files changed, 1 insertions, 1 deletions
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);
}