mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Updated
This commit is contained in:
parent
ed8fe6fbf1
commit
3c503c981f
3 changed files with 27 additions and 41 deletions
|
@ -10,6 +10,7 @@
|
|||
define('IN_TRACKER', true);
|
||||
define('BB_ROOT', './../');
|
||||
require dirname(__DIR__) . '/common.php';
|
||||
require __DIR__ . '/includes/init_tr.php';
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
|
@ -135,9 +136,7 @@ if ($lp_info && (!isset($event) || $event !== 'stopped')) {
|
|||
drop_fast_announce($lp_info);
|
||||
}
|
||||
|
||||
// Start announcer
|
||||
require __DIR__ . '/includes/init_tr.php';
|
||||
|
||||
// Events
|
||||
$seeder = ($left == 0) ? 1 : 0;
|
||||
$stopped = ($event === 'stopped');
|
||||
$completed = ($event === 'completed');
|
||||
|
@ -400,31 +399,6 @@ if (!$output) {
|
|||
$peers_list_cached = CACHE('tr_cache')->set(PEERS_LIST_PREFIX . $topic_id, $output, PEERS_LIST_EXPIRE);
|
||||
}
|
||||
|
||||
// Functions
|
||||
function drop_fast_announce($lp_info)
|
||||
{
|
||||
global $announce_interval;
|
||||
|
||||
if ($lp_info['update_time'] < (TIMENOW - $announce_interval + 60)) {
|
||||
return; // if announce interval correct
|
||||
}
|
||||
|
||||
$new_ann_intrv = $lp_info['update_time'] + $announce_interval - TIMENOW;
|
||||
|
||||
dummy_exit($new_ann_intrv);
|
||||
}
|
||||
|
||||
function msg_die($msg)
|
||||
{
|
||||
$output = \SandFox\Bencode\Bencode::encode([
|
||||
'min interval' => (int)1800,
|
||||
'failure reason' => (string)$msg,
|
||||
'warning message' => (string)$msg,
|
||||
]);
|
||||
|
||||
die($output);
|
||||
}
|
||||
|
||||
// Return data to client
|
||||
echo \SandFox\Bencode\Bencode::encode($output);
|
||||
|
||||
|
|
|
@ -36,3 +36,27 @@ function error_exit($msg = '')
|
|||
|
||||
exit;
|
||||
}
|
||||
|
||||
function drop_fast_announce($lp_info)
|
||||
{
|
||||
global $announce_interval;
|
||||
|
||||
if ($lp_info['update_time'] < (TIMENOW - $announce_interval + 60)) {
|
||||
return; // if announce interval correct
|
||||
}
|
||||
|
||||
$new_ann_intrv = $lp_info['update_time'] + $announce_interval - TIMENOW;
|
||||
|
||||
dummy_exit($new_ann_intrv);
|
||||
}
|
||||
|
||||
function msg_die($msg)
|
||||
{
|
||||
$output = \SandFox\Bencode\Bencode::encode([
|
||||
'min interval' => (int)1800,
|
||||
'failure reason' => (string)$msg,
|
||||
'warning message' => (string)$msg,
|
||||
]);
|
||||
|
||||
die($output);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
define('IN_TRACKER', true);
|
||||
define('BB_ROOT', './../');
|
||||
require dirname(__DIR__) . '/common.php';
|
||||
require __DIR__ . '/includes/init_tr.php';
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
|
@ -39,19 +40,6 @@ if (strlen($info_hash) == 32) {
|
|||
msg_die('Invalid info_hash');
|
||||
}
|
||||
|
||||
function msg_die($msg)
|
||||
{
|
||||
$output = \SandFox\Bencode\Bencode::encode([
|
||||
'min interval' => (int)1800,
|
||||
'failure reason' => (string)$msg,
|
||||
'warning message' => (string)$msg,
|
||||
]);
|
||||
|
||||
die($output);
|
||||
}
|
||||
|
||||
require __DIR__ . '/includes/init_tr.php';
|
||||
|
||||
$info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
|
||||
/**
|
||||
* Поскольку торрент-клиенты в настоящее время обрезают инфо-хэш до 20 символов (независимо от его типа, как известно v1 = 20 символов, а v2 = 32 символа),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue