Bind peer_hash to auth_key to avoid double announces via IPv4 and IPv6 at the same time (#1016)

This commit is contained in:
Cønstantine Kovalensky 2023-11-02 19:21:24 +04:00 committed by GitHub
commit 1c7d45eabe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {