mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
fix getConnectable ipv6
This commit is contained in:
@@ -879,9 +879,13 @@ class TrackerRepository extends BaseRepository
|
||||
{
|
||||
$cacheKey = 'peers:connectable:'.$ip.'-'.$port.'-'.$agent;
|
||||
$log = "cacheKey: $cacheKey";
|
||||
$hostname = $ip;
|
||||
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$hostname = '['.$ip.']';
|
||||
}
|
||||
$connectable = Cache::get($cacheKey);
|
||||
if ($connectable === null) {
|
||||
$con = @fsockopen($ip, $port, $error_code, $error_message, 1);
|
||||
$con = @fsockopen($hostname, $port, $error_code, $error_message, 1);
|
||||
if (is_resource($con)) {
|
||||
$connectable = Peer::CONNECTABLE_YES;
|
||||
fclose($con);
|
||||
|
||||
Reference in New Issue
Block a user