Skip to content

Commit

Permalink
Merge pull request #1995 from Roardom/master
Browse files Browse the repository at this point in the history
(Update) Peerlist generation
  • Loading branch information
HDVinnie authored Nov 11, 2021
2 parents 9d673b0 + 1a59c71 commit a825451
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/Http/Controllers/AnnounceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,12 @@ private function generateSuccessAnnounceResponse($queries, $torrent, $user): arr
$limit = ($queries['numwant'] <= 50 ? $queries['numwant'] : 50);

// Get Torrents Peers
$peers = Peer::where('torrent_id', '=', $torrent->id)->where('user_id', '!=', $user->id)->take($limit)->get()->toArray();
if ($queries['left'] == 0) {
// Only include leechers in a seeder's peerlist
$peers = Peer::where('torrent_id', '=', $torrent->id)->where('seeder', '=', 0)->where('user_id', '!=', $user->id)->take($limit)->get()->toArray();
} else {
$peers = Peer::where('torrent_id', '=', $torrent->id)->where('user_id', '!=', $user->id)->take($limit)->get()->toArray();
}

$repDict['peers'] = $this->givePeers($peers, $queries['compact'], $queries['no_peer_id']);
$repDict['peers6'] = $this->givePeers($peers, $queries['compact'], $queries['no_peer_id'], FILTER_FLAG_IPV6);
Expand Down

0 comments on commit a825451

Please sign in to comment.