mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-03 00:40:12 -05:00
fix: connectivity check on external tracker
The external tracker updates the peer row and doesn't touch the redis cache.
This commit is contained in:
@@ -30,7 +30,7 @@ class TorrentPeerController extends Controller
|
||||
'torrent' => $torrent,
|
||||
'peers' => Peer::query()
|
||||
->with('user')
|
||||
->select(['torrent_id', 'user_id', 'uploaded', 'downloaded', 'left', 'port', 'agent', 'created_at', 'updated_at', 'seeder', 'active', 'visible'])
|
||||
->select(['torrent_id', 'user_id', 'uploaded', 'downloaded', 'left', 'port', 'agent', 'created_at', 'updated_at', 'seeder', 'active', 'visible', 'connectable'])
|
||||
->selectRaw('INET6_NTOA(ip) as ip')
|
||||
->where('torrent_id', '=', $id)
|
||||
->orderByDesc('active')
|
||||
|
||||
@@ -90,7 +90,7 @@ class UserController extends Controller
|
||||
'invitedBy' => Invite::where('accepted_by', '=', $user->id)->first(),
|
||||
'clients' => $user->peers()
|
||||
->select('agent', 'port')
|
||||
->selectRaw('INET6_NTOA(ip) as ip, MIN(created_at) as created_at, MAX(updated_at) as updated_at, COUNT(*) as num_peers')
|
||||
->selectRaw('INET6_NTOA(ip) as ip, MIN(created_at) as created_at, MAX(updated_at) as updated_at, COUNT(*) as num_peers, MAX(connectable) as connectable')
|
||||
->groupBy(['ip', 'port', 'agent'])
|
||||
->where('active', '=', true)
|
||||
->get(),
|
||||
|
||||
@@ -294,7 +294,9 @@
|
||||
<td class="user-active__connectable">
|
||||
@php
|
||||
$connectable = null;
|
||||
if (cache()->has('peers:connectable:' . $active->ip . '-' . $active->port . '-' . $active->agent)) {
|
||||
if (config('announce.external_tracker.is_enabled')) {
|
||||
$connectable = $active->connectable;
|
||||
} elseif (cache()->has('peers:connectable:' . $active->ip . '-' . $active->port . '-' . $active->agent)) {
|
||||
$connectable = cache()->get('peers:connectable:' . $active->ip . '-' . $active->port . '-' . $active->agent);
|
||||
}
|
||||
@endphp
|
||||
|
||||
@@ -106,7 +106,9 @@
|
||||
@if (\config('announce.connectable_check') == true)
|
||||
@php
|
||||
$connectable = false;
|
||||
if (cache()->has('peers:connectable:' . $peer->ip . '-' . $peer->port . '-' . $peer->agent)) {
|
||||
if (config('announce.external_tracker.is_enabled')) {
|
||||
$connectable = $peer->connectable;
|
||||
} elseif (cache()->has('peers:connectable:' . $peer->ip . '-' . $peer->port . '-' . $peer->agent)) {
|
||||
$connectable = cache()->get('peers:connectable:' . $peer->ip . '-' . $peer->port . '-' . $peer->agent);
|
||||
}
|
||||
@endphp
|
||||
|
||||
@@ -303,7 +303,9 @@
|
||||
@if (\config('announce.connectable_check') == true)
|
||||
@php
|
||||
$connectable = false;
|
||||
if (cache()->has('peers:connectable:' . $client->ip . '-' . $client->port . '-' . $client->agent)) {
|
||||
if (config('announce.external_tracker.is_enabled')) {
|
||||
$connectable = $client->connectable;
|
||||
} elseif (cache()->has('peers:connectable:' . $client->ip . '-' . $client->port . '-' . $client->agent)) {
|
||||
$connectable = cache()->get('peers:connectable:' . $client->ip . '-' . $client->port . '-' . $client->agent);
|
||||
}
|
||||
@endphp
|
||||
|
||||
Reference in New Issue
Block a user