added tracker failure check

This commit is contained in:
mykola2312 2022-03-18 20:43:48 +02:00
parent aeda1d2718
commit da82b6829a

View file

@ -57,6 +57,10 @@ class Tracker {
}
$response = bdecode($result);
if (array_key_exists($response, "failure reason")) {
return false;
}
$peersEnc = $response["peers"];
for ($i = 0; $i < strlen($peersEnc); $i+=6) {
$remoteIp = long2ip(unpack("N", $peersEnc, $i)[1]);