diff --git a/src/ASP/system/modules/Serverinfo.php b/src/ASP/system/modules/Serverinfo.php index f397b11b..d8d4a263 100644 --- a/src/ASP/system/modules/Serverinfo.php +++ b/src/ASP/system/modules/Serverinfo.php @@ -187,6 +187,18 @@ protected function loadGamespyData($ip, $port) $end = true; } + // Smaller servers will respond with only 2 packets. + // If we got all 2 packets, and Packet 2 starts with this header, we're done. Don't need to wait for socket timeout + if ($i == 2 && stripos($Packet[2], "\x00\x10\x20\x30@splitnum\x00\x81\x01") === 0) { + $end = true; + } + + // Larger servers will respond with 3 packets. + // If we got all 3 packets, and Packet 3 starts with this header, we're done. Don't need to wait for socket timeout + if ($i == 3 && stripos($Packet[3], "\x00\x10\x20\x30@splitnum\x00\x82\x02") === 0) { + $end = true; + } + $i++; } @@ -219,7 +231,12 @@ protected function loadGamespyData($ip, $port) $players = $p3 ? substr($players,0,$p3) : substr($players,0); $players = str_replace("\\ 0@splitnum\�","",$players); $players = str_replace("\\ 0@splitnum\\�","",$players); - $players = str_replace("\\\x10\x20\x30@splitnum\\\x81\x01","",$players); + $players = str_replace(" 0@splitnum\\","",$players); + $players = str_replace(" 0@splitnum\\�","",$players); + $players = str_replace("\x10\x20\x30@splitnum\\\x81\x01","",$players); + $players = str_replace("\x10\x20\x30@splitnum\\\x82\x02","",$players); + // Strip the cut-off prop. E.g. '\F. Liliegren\\score\\score_\\0\0' becomes '\F. Liliegren\\score_\\0' + $players = preg_replace('/\\\\{2}[^_\\\\]+(\\\\{2}[^_\\\\]+_\\\\)/',"$1",$players); //Parse Rules $rule_temp = substr($rules,1);