aboutsummaryrefslogtreecommitdiff
path: root/src/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http.c')
-rw-r--r--src/http.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/http.c b/src/http.c
index b585585..9d88252 100644
--- a/src/http.c
+++ b/src/http.c
@@ -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
{