Skip to content

Commit

Permalink
rand announce time
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Jul 5, 2024
1 parent 137be0c commit 6516d90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.12');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-07-04');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-07-06');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
Expand Down
11 changes: 8 additions & 3 deletions public/announce.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,16 @@
*/
$peerlistsql = "SELECT ".$fields." FROM peers WHERE torrent = " . $torrentid . $only_leech_query . $limit;

$real_annnounce_interval = $announce_interval;
$announce_one_begin = (0+$announce_interval)/2;
$announce_one_end = ($announce_interval+$annintertwo)/2;
$announce_two_end = ($annintertwo+$anninterthree)/2;
$announce_three_end = $anninterthree;//can not bigger, cleanup will consider dead and delete it

$real_annnounce_interval = mt_rand($announce_one_begin, $announce_one_end);
if ($anninterthreeage && ($anninterthree > $announce_wait) && (TIMENOW - $torrent['ts']) >= ($anninterthreeage * 86400))
$real_annnounce_interval = $anninterthree;
$real_annnounce_interval = mt_rand($announce_two_end, $announce_three_end);
elseif ($annintertwoage && ($annintertwo > $announce_wait) && (TIMENOW - $torrent['ts']) >= ($annintertwoage * 86400))
$real_annnounce_interval = $annintertwo;
$real_annnounce_interval = mt_rand($announce_one_end, $announce_two_end);

//$resp = "d" . benc_str("interval") . "i" . $real_annnounce_interval . "e" . benc_str("min interval") . "i" . $announce_wait . "e". benc_str("complete") . "i" . $torrent["seeders"] . "e" . benc_str("incomplete") . "i" . $torrent["leechers"] . "e" . benc_str("peers");
$rep_dict = [
Expand Down

1 comment on commit 6516d90

@1265578519
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

第三方xiaomlove版nexusphp已经集成随机时间代码:6516d90
群友更新后的CPU效果图
1

原帖:https://bbs.itzmx.com/thread-106752-1-1.html

Please sign in to comment.