diff options
author | erdgeist <> | 2007-01-07 00:20:20 +0000 |
---|---|---|
committer | erdgeist <> | 2007-01-07 00:20:20 +0000 |
commit | 62a6f605595b8a71f4c8654e50408ce69efadcef (patch) | |
tree | 1ee7cf9e1135047a1c57990a2010f1c4f0c6baf4 /opentracker.c | |
parent | 38432480a10e4f89c7ed0442899d5b6d57ce6222 (diff) |
add timeout for clients
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/opentracker.c b/opentracker.c index ab3eace..47e6f8d 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include "trackerlogic.h" | 26 | #include "trackerlogic.h" |
27 | #include "scan_urlencoded_query.h" | 27 | #include "scan_urlencoded_query.h" |
28 | 28 | ||
29 | unsigned long const OT_CLIENT_TIMEOUT = 15; | ||
30 | |||
29 | static unsigned int ot_overall_connections = 0; | 31 | static unsigned int ot_overall_connections = 0; |
30 | static time_t ot_start_time; | 32 | static time_t ot_start_time; |
31 | static const unsigned int SUCCESS_HTTP_HEADER_LENGTH = 80; | 33 | static const unsigned int SUCCESS_HTTP_HEADER_LENGTH = 80; |
@@ -376,6 +378,7 @@ void help( char *name ) { | |||
376 | 378 | ||
377 | int main( int argc, char **argv ) { | 379 | int main( int argc, char **argv ) { |
378 | int s=socket_tcp4(); | 380 | int s=socket_tcp4(); |
381 | tai6464 t; | ||
379 | unsigned long ip; | 382 | unsigned long ip; |
380 | char *serverip = NULL; | 383 | char *serverip = NULL; |
381 | char *serverdir = "."; | 384 | char *serverdir = "."; |
@@ -439,6 +442,9 @@ allparsed: | |||
439 | { | 442 | { |
440 | byte_zero(h,sizeof(struct http_data)); | 443 | byte_zero(h,sizeof(struct http_data)); |
441 | h->ip=ip; | 444 | h->ip=ip; |
445 | taia_now(&t); | ||
446 | taia_addsec(&t,&t,OT_CLIENT_TIMEOUT); | ||
447 | io_timeout(n,t); | ||
442 | io_setcookie(n,h); | 448 | io_setcookie(n,h); |
443 | ++ot_overall_connections; | 449 | ++ot_overall_connections; |
444 | } else | 450 | } else |