fix: announce controller

Check if client is announcing torrent as complete before applying slots error
This commit is contained in:
clandestine8
2022-04-01 10:29:04 -04:00
parent 50dbebb2e0
commit 73af2bc37f

View File

@@ -112,7 +112,7 @@ class AnnounceController extends Controller
* Check Download Slots.
*/
if (\config('announce.slots_system.enabled') == true) {
$this->checkDownloadSlots($user);
$this->checkDownloadSlots($queries, $user);
}
/**
@@ -402,15 +402,15 @@ class AnnounceController extends Controller
/**
* @throws \App\Exceptions\TrackerException
*/
private function checkDownloadSlots($user): void
private function checkDownloadSlots($queries, $user): void
{
$max = $user->group->download_slots;
if ($max !== null && $max >= 0) {
if ($max !== null && $max >= 0 && $queries['left'] != 0) {
$count = Peer::where('user_id', '=', $user->id)
->where('seeder', '=', 0)
->count();
if ($count >= $max) {
if ($count >= $max ) {
throw new TrackerException(164, [':max' => $max]);
}
}