]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
Fix misunderstandig of what libowfat thinks are seconds and what I did...
authorerdgeist <>
Fri, 19 Oct 2007 02:00:53 +0000 (02:00 +0000)
committererdgeist <>
Fri, 19 Oct 2007 02:00:53 +0000 (02:00 +0000)
opentracker.c

index 10e9f65c6bdc9adeb1ac16e62e1e800dd9464110..28ac0713cd649243415c74783bb0506f6dc2072c 100644 (file)
@@ -166,7 +166,8 @@ static void sendmmapdata( const int64 s, char *buffer, size_t size ) {
 
   /* writeable sockets timeout after twice the pool timeout
      which defaults to 5 minutes (e.g. after 10 minutes) */
-  taia_uint( &t, (unsigned int)(g_now + OT_CLIENT_TIMEOUT_SEND) ); io_timeout( s, t );
+  taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND );
+  io_timeout( s, t );
   io_dontwantread( s );
   io_wantwrite( s );
 }
@@ -199,9 +200,8 @@ static void senddata( const int64 s, char *buffer, size_t size ) {
     iob_addbuf_free( &h->batch, outbuf, size - written_size );
     h->flag |= STRUCT_HTTP_FLAG_IOB_USED;
 
-    /* writeable sockets timeout after twice the pool timeout
-       which defaults to 5 minutes (e.g. after 10 minutes) */
-    taia_uint( &t, (unsigned int)(g_now + OT_CLIENT_TIMEOUT_SEND) ); io_timeout( s, t );
+    /* writeable short data sockets just have a tcp timeout */
+    taia_uint( &t, 0 ); io_timeout( s, t );
     io_dontwantread( s );
     io_wantwrite( s );
   }
@@ -647,7 +647,10 @@ static void handle_accept( const int64 serversocket ) {
 
     ++ot_overall_tcp_connections;
 
-    taia_uint( &t, (unsigned int)(g_now + OT_CLIENT_TIMEOUT) );
+    /* That breaks taia encapsulation. But there is no way to take system
+       time this often in FreeBSD and libowfat does not allow to set unix time */
+    taia_uint( &t, 0 ); /* Clear t */
+    tai_unix( &(t.sec), (g_now + OT_CLIENT_TIMEOUT) );
     io_timeout( i, t );
   }