]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
make the interval with random an average value around the real value and not additional
authordenis <>
Thu, 1 Feb 2007 22:34:23 +0000 (22:34 +0000)
committerdenis <>
Thu, 1 Feb 2007 22:34:23 +0000 (22:34 +0000)
trackerlogic.h

index 74440f458ad1fd3d0a0561e122bcc8d786fcafad..66e8c2ab02200404e8fb08e1b3fb7117ce9e0398 100644 (file)
@@ -25,9 +25,10 @@ typedef time_t         ot_time;
 #define OT_CLIENT_REQUEST_INTERVAL (60*30)
 #define OT_CLIENT_REQUEST_VARIATION (60*3)
 
-#define OT_TORRENT_TIMEOUT ((60*60*24)/OT_POOLS_TIMEOUT)
+#define OT_TORRENT_TIMEOUT_HOURS 24
+#define OT_TORRENT_TIMEOUT ((60*60*OT_TORRENT_TIMEOUT_HOURS)/OT_POOLS_TIMEOUT)
 
-#define OT_CLIENT_REQUEST_INTERVAL_RANDOM ( OT_CLIENT_REQUEST_INTERVAL + (int)( random( ) % OT_CLIENT_REQUEST_VARIATION ) )
+#define OT_CLIENT_REQUEST_INTERVAL_RANDOM ( OT_CLIENT_REQUEST_INTERVAL - OT_CLIENT_REQUEST_VARIATION/2 + (int)( random( ) % OT_CLIENT_REQUEST_VARIATION ) )
 
 /* We maintain a list of 256 pointers to sorted list of ot_torrent structs
    Sort key is, of course, its hash */