swetorrentking / rartracker

Complete private bittorrent tracker written in PHP and AngularJS
198 stars 67 forks source link

Is this a normal response from the tracker? #34

Closed ihv40894 closed 8 years ago

ihv40894 commented 8 years ago

d8:intervali2344e12:min intervali900e5:peers18:������ee

I am having problems connecting to other peers on a torrent. My clients connect now to the tracker and the site even updates and says there is 1 seeder and 1 leecher. However the two peers never find each other and never start downloading/uploading.

I am in the process of trying to find out why and i noticed the response I get back from the tracker is all regular text except for the compact peer list part which shows up in all question mark errors things. Is something wrong or is this normal? I assume this could be the reason for clients not connecting to each other?

ihv40894 commented 8 years ago

Hope this helps someone.

Once again, I think it was due to cloudflare messing it out. Basically it was returning two ip's on the get IP function in tracker.php - so I made a modification to fix this issue.

function getip() { if (isset($_SERVER)) { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } else { $ip = $_SERVER['REMOTE_ADDR']; } } else { if (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } else { $ip = getenv('REMOTE_ADDR'); } }

if (strstr($ip, ', ')) {
    $ips = explode(', ', $ip);
    $ip = $ips[0];
}

return $ip;

}