Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

86/500 servers online help! #153

Closed
wazzaa opened this issue Jan 14, 2014 · 2 comments
Closed

86/500 servers online help! #153

wazzaa opened this issue Jan 14, 2014 · 2 comments
Labels
Bug This request does fix a bug. v2

Comments

@wazzaa
Copy link

wazzaa commented Jan 14, 2014

Hello, i have a little trouble:
i using codeigniter with your library, and i have problem
i've get from database 500 and put it to gameq, And gameq always returns 86 online servers, but i sure that all others are offline.

My newbie-code:

public function index()
{
//$results['data'] = $this->_get_servers_list();
//Trying to get cached servers list
if(!$this->cache->file->get('serverslist'))
{
//If no... cache it
$results['data'] = $this->_cache_servers_list();
}
else
{
//Else - get cached servers list from cached file
$results['data'] = unserialize($this->cache->file->get('serverslist'));
}

    //print_r($results['data']);

    $this->load->view('serverslist', $results);
}



public function _get_servers_list()
{
    //Gettings servers from database
    $query = $this->database->_get_server_list('servers', 500);
    $data = $query->result();


    //Preparing servers list for GameQ
    foreach($data as $result)
    {

        $servers[] = array(
        'id' => $result->id,
        'host' => $result->address,
        'type' => 'cs16'
        );
    }


    //Getting servers data with GameQ
    $results = GameQ::factory()
    ->setOption('debug', true)
    //->setOption('raw', true)
    ->setFilter('normalise')

    ->addServers($servers)
    ->requestData();


    //Parsing offline servers
    foreach($results as $id => $value)
    {
        if(!$results[$id]['gq_online'])
        {
            //unset($results[$id]);
            //$results[$id]['gq_hostname'] = 'Server offline or changing map';
        }
    }
    return $results;
}

public function _cache_servers_list()
{   
    //Getting servers list
    $data = serialize($this->_get_servers_list());

    //Caching servers list
    $this->cache->file->save('serverslist', $data, 120);

    return unserialize($data);
}

When i turn ->setOption('debug', true):

Fatal error: Uncaught exception 'GameQ_ProtocolsException' with message 'Data for GameQ_Protocols_Source::process_players does not have the proper header (should be 0xFF0xFF0xFF0xFF0x44). Header: ffffffff41' in Z:\home\mon\www\application\libraries\GameQ\gameq\protocols\source.php:266 Stack trace: #0 [internal function]: GameQ_Protocols_Source->process_players() #1 Z:\home\mon\www\application\libraries\GameQ\gameq\protocols\core.php(547): call_user_func_array(Array, Array) #2 Z:\home\mon\www\application\libraries\GameQ\GameQ.php(485): GameQ_Protocols_Core->processResponse() #3 Z:\home\mon\www\application\libraries\GameQ\GameQ.php(467): GameQ->filterResponse(Object(GameQ_Protocols_Cs16)) #4 Z:\home\mon\www\application\controllers\servers.php(62): GameQ->requestData() #5 Z:\home\mon\www\application\controllers\servers.php(80): Servers->_get_servers_list() #6 Z:\home\mon\www\application\controllers\servers.php(21): Servers->_cache_servers_list() #7 [internal function]: Servers->index() #8 Z:\home\mon\www\system\core\CodeIgni in Z:\home\mon\www\application\libraries\GameQ\gameq\protocols\core.php on line 555

Thanx:)

@wazzaa
Copy link
Author

wazzaa commented Jan 16, 2014

But when i use php version 5.2.17, amount of servers increased to 171. Please, help me to fix this problem.

@Austinb
Copy link
Owner

Austinb commented Feb 2, 2014

There is a known limitation in the library that limits the number of servers it can query before it begins to behave oddly. An old issue on this is #98 and there is some information in there. I dont have the time to break down the code to find the issue. Maybe soon.

@Austinb Austinb closed this as completed Feb 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This request does fix a bug. v2
Projects
None yet
Development

No branches or pull requests

2 participants