# HG changeset patch # User Adam Chlipala # Date 1388419302 18000 # Node ID 6b80900ddc668c94818e2ef187d7b6027925dbdb # Parent 619191c71abb664af11dab40e5950630a1290d42 HTTP: continue after accept() failure diff -r 619191c71abb -r 6b80900ddc66 src/c/http.c --- a/src/c/http.c Sun Dec 29 13:18:50 2013 -0500 +++ b/src/c/http.c Mon Dec 30 11:01:42 2013 -0500 @@ -430,19 +430,19 @@ int new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size); if (new_fd < 0) { - fprintf(stderr, "Socket accept failed\n"); - return 1; + if (!quiet) + fprintf(stderr, "Socket accept failed\n"); + } else { + if (!quiet) + printf("Accepted connection.\n"); + + if (keepalive) { + int flag = 1; + setsockopt(new_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); + } + + uw_enqueue(new_fd); } - - if (!quiet) - printf("Accepted connection.\n"); - - if (keepalive) { - int flag = 1; - setsockopt(new_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); - } - - uw_enqueue(new_fd); } }