Don't re-announce for hybrids if the event is "stopped" (#1099)

This commit is contained in:
Cønstantine Kovalensky 2023-11-14 19:33:47 +04:00 committed by GitHub
commit 6ae8dc8d5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -200,12 +200,9 @@ if ($lp_info) {
// Check hybrid torrents // Check hybrid torrents
if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) { if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) {
// Helpful dev variables
$is_hybrid = true; $is_hybrid = true;
$hybrid_v1_hash = &$row['info_hash']; if ($info_hash === $row['info_hash']) {
$hybrid_v2_hash = &$row['info_hash_v2']; $update_hybrid = true;
if ($info_hash === $hybrid_v1_hash) {
$hybrid_tor_update = true;
} }
} }
@ -306,7 +303,7 @@ if ($bb_cfg['tracker']['freeleech'] && $down_add) {
// Insert / update peer info // Insert / update peer info
$peer_info_updated = false; $peer_info_updated = false;
$update_time = ($stopped) ? 0 : TIMENOW; $update_time = ($stopped) ? 0 : TIMENOW;
if (isset($hybrid_tor_update) || !isset($is_hybrid)) { // Update statistics only for one topic if (!isset($is_hybrid) || isset($update_hybrid)) { // Update statistics only for one topic
if ($lp_info) { if ($lp_info) {
$sql = "UPDATE " . BB_BT_TRACKER . " SET update_time = $update_time"; $sql = "UPDATE " . BB_BT_TRACKER . " SET update_time = $update_time";
@ -337,7 +334,7 @@ if (isset($hybrid_tor_update) || !isset($is_hybrid)) { // Update statistics only
$peer_info_updated = DB()->affected_rows(); $peer_info_updated = DB()->affected_rows();
} }
if (!$lp_info || !$peer_info_updated) { if ((!$lp_info || !$peer_info_updated) && !$stopped) {
$columns = "peer_hash, topic_id, user_id, $ip_version, port, seeder, releaser, tor_type, uploaded, downloaded, remain, speed_up, speed_down, up_add, down_add, update_time, complete, peer_id"; $columns = "peer_hash, topic_id, user_id, $ip_version, port, seeder, releaser, tor_type, uploaded, downloaded, remain, speed_up, speed_down, up_add, down_add, update_time, complete, peer_id";
$values = "'$peer_hash', $topic_id, $user_id, '$ip_sql', $port, $seeder, $releaser, $tor_type, $uploaded, $downloaded, $left, $speed_up, $speed_down, $up_add, $down_add, $update_time, $complete, '$peer_id_sql'"; $values = "'$peer_hash', $topic_id, $user_id, '$ip_sql', $port, $seeder, $releaser, $tor_type, $uploaded, $downloaded, $left, $speed_up, $speed_down, $up_add, $down_add, $update_time, $complete, '$peer_id_sql'";