diff options
Diffstat (limited to 'src/http.c')
-rw-r--r-- | src/http.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -14,6 +14,12 @@ #include <stdio.h> #include <stdlib.h> +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -92,6 +98,7 @@ int HTTP_ReadFromClient(cGH *cctkGH, void *connection) int request_buffer_length; char *request_buffer; char *tmp; + struct timeval timeout = {1, 0}; int found_eoh; int failure_count; @@ -121,8 +128,8 @@ int HTTP_ReadFromClient(cGH *cctkGH, void *connection) CCTK_WARN(1, "Got 0 bytes when waiting for end of HTTP request header"); if(failure_count < 3) { + select (0, NULL, NULL, NULL, &timeout); failure_count++; - sleep(1); } else { |