From: denis <> Date: Thu, 1 Feb 2007 22:34:23 +0000 (+0000) Subject: make the interval with random an average value around the real value and not additional X-Git-Tag: OPENTRACKER_WITH_BATCHSYNC~279 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=929d375b973b2a30fbc75ea31595aa3f042d5cc2;p=thirdparty%2Fopentracker.git make the interval with random an average value around the real value and not additional --- diff --git a/trackerlogic.h b/trackerlogic.h index 74440f4..66e8c2a 100644 --- a/trackerlogic.h +++ b/trackerlogic.h @@ -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 */