From 1c7d45eabe209979f81b74cc191de920d34dcd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B8nstantine=20Kovalensky?= <45331093+kovalensky@users.noreply.github.com> Date: Thu, 2 Nov 2023 19:21:24 +0400 Subject: [PATCH] Bind peer_hash to auth_key to avoid double announces via IPv4 and IPv6 at the same time (#1016) --- bt/announce.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bt/announce.php b/bt/announce.php index d6ff38c90..a38755a6b 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -122,7 +122,7 @@ if (!\TorrentPier\Helpers\IPHelper::isValid($ip)) { $ip_sql = \TorrentPier\Helpers\IPHelper::ip2long($ip); // Peer unique id -$peer_hash = hash('xxh128', rtrim($info_hash, ' ') . $passkey . $ip . $port); +$peer_hash = hash('xxh128', $passkey . $info_hash_hex); // Events $stopped = ($event === 'stopped'); @@ -372,7 +372,7 @@ if (!$output) { "); if (empty($rowset)) { - $rowset[] = ['ip' => \TorrentPier\Helpers\IPHelper::ip2long($ip), 'port' => (int)$port]; + $rowset[] = ['ip' => $ip_sql, 'port' => (int)$port]; } if ($compact_mode) {