From 62a6f605595b8a71f4c8654e50408ce69efadcef Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Sun, 7 Jan 2007 00:20:20 +0000 Subject: add timeout for clients --- opentracker.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'opentracker.c') diff --git a/opentracker.c b/opentracker.c index ab3eace..47e6f8d 100644 --- a/opentracker.c +++ b/opentracker.c @@ -26,6 +26,8 @@ #include "trackerlogic.h" #include "scan_urlencoded_query.h" +unsigned long const OT_CLIENT_TIMEOUT = 15; + static unsigned int ot_overall_connections = 0; static time_t ot_start_time; static const unsigned int SUCCESS_HTTP_HEADER_LENGTH = 80; @@ -376,6 +378,7 @@ void help( char *name ) { int main( int argc, char **argv ) { int s=socket_tcp4(); + tai6464 t; unsigned long ip; char *serverip = NULL; char *serverdir = "."; @@ -439,6 +442,9 @@ allparsed: { byte_zero(h,sizeof(struct http_data)); h->ip=ip; + taia_now(&t); + taia_addsec(&t,&t,OT_CLIENT_TIMEOUT); + io_timeout(n,t); io_setcookie(n,h); ++ot_overall_connections; } else -- cgit v1.2.3