From 3e053797633c8e7403268a82713658efc1c2bb3e Mon Sep 17 00:00:00 2001 From: Godmar Back Date: Sun, 29 Apr 2018 17:58:19 -0400 Subject: [PATCH] better error handling for when accept fails --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 35d4822..6873983 100644 --- a/src/main.c +++ b/src/main.c @@ -26,7 +26,7 @@ static void server_loop(char *port_string) { int accepting_socket = socket_open_bind_listen(port_string, 1024); - for (;;) { + while (accepting_socket != -1) { fprintf(stderr, "Waiting for client...\n"); int client_socket = socket_accept_client(accepting_socket); if (client_socket == -1)