diff options
author | 2013-12-30 11:01:42 -0500 | |
---|---|---|
committer | 2013-12-30 11:01:42 -0500 | |
commit | 3f3e77a6694283b6eae525a0ebfba4fc3bbb8163 (patch) | |
tree | 5c5b4fbb63d77d65a48a29e0b75046a421ce7e9b /src/c/http.c | |
parent | ca6926d0e0d1af6ea0531c6c558943beb08f646c (diff) |
HTTP: continue after accept() failure
Diffstat (limited to 'src/c/http.c')
-rw-r--r-- | src/c/http.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/c/http.c b/src/c/http.c index 18e188da..25d2a320 100644 --- a/src/c/http.c +++ b/src/c/http.c @@ -430,19 +430,19 @@ int main(int argc, char *argv[]) { 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 (!quiet) - printf("Accepted connection.\n"); + if (keepalive) { + int flag = 1; + setsockopt(new_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); + } - if (keepalive) { - int flag = 1; - setsockopt(new_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); + uw_enqueue(new_fd); } - - uw_enqueue(new_fd); } } |