Eris::Meta Class Reference

Meta encapsulates the meta-game system, including the meta-server protocol and queries. More...

#include <Metaserver.h>

List of all members.

Public Member Functions

 Meta (const std::string &msv, unsigned int maxQueries)
 Create a Metaserver object, which manages all interaction with the metaserver itself, and querying active game servers.
unsigned int getGameServerCount () const
 Return the total number of game servers the meta server knows about.
const ServerInfogetInfoForServer (unsigned int index) const
 Retrive one of the servers.
void queryServerByIndex (unsigned int index)
 Query a specific game server; emits a signal when complete.
void refresh ()
 Refresh the entire server list.
void cancel ()
 Cancel outstanding refresh / queries.

Public Attributes

sigc::signal< void, const
ServerInfo & > 
ReceivedServerInfo
 Emitted when information about a server is received.
sigc::signal< void, int > CompletedServerList
 Emitted once the complete list of servers has been retrived from the metaserver.
sigc::signal< void > AllQueriesDone
 Emitted when the entire server list has been refreshed.
sigc::signal< void, const
std::string & > 
Failure
 Indicates a failure (usually network related) has occurred.

Protected Member Functions

virtual void objectArrived (const Atlas::Objects::Root &obj)
void doFailure (const std::string &msg)
void queryFailure (MetaQuery *q, const std::string &msg)
void queryTimeout (MetaQuery *q)
void metaTimeout ()
void connect ()
 initiate a connection to the meta-server : this will issue a keep-alive followed by a list request.
void disconnect ()
 tear down an existing connection to the server

Friends

class MetaQuery

Detailed Description

Meta encapsulates the meta-game system, including the meta-server protocol and queries.


Constructor & Destructor Documentation

Eris::Meta::Meta ( const std::string &  msv,
unsigned int  maxQueries 
)

Create a Metaserver object, which manages all interaction with the metaserver itself, and querying active game servers.

Clients might create this object when showing a 'server list' dialog, and use the signals and accessors to pouplate the list. Signals and methods are provided to support common things like displaying query progress, and canceling queries.

Parameters:
msv The metaserver to query, specified as a hostname. Usually metaserver.worldforge.org, but that's up to you.
maxQueries The maximum number of game server queries to have active at any one time. 10 is a sensible value, too low and querying will take a long time, too high and .... I'm not sure.

Member Function Documentation

void Eris::Meta::cancel (  ) 

Cancel outstanding refresh / queries.

This is primarily intended for use with 'Refresh', which might takes several minutes to complete. Note that 'CompletedServerList' is not emitted following cancellation.

References disconnect().

void Eris::Meta::connect (  )  [protected]

initiate a connection to the meta-server : this will issue a keep-alive followed by a list request.

References disconnect().

Referenced by refresh().

unsigned int Eris::Meta::getGameServerCount (  )  const

Return the total number of game servers the meta server knows about.

const ServerInfo & Eris::Meta::getInfoForServer ( unsigned int  index  )  const

Retrive one of the servers.

Note the ServerInfo object may be invalid if the server has not yet been queried, or has timedout or otherwise failed to answer the query.

void Eris::Meta::refresh (  ) 

Refresh the entire server list.

This will clear the current list, ask the meta-server for each game server, and then issue a query against every returned server. This process can take a large amount of real-time as the number of game servers increases. Completion of the entire refresh is indicated by the 'CompletedServerList' signal.

References connect().


Member Data Documentation

sigc::signal<void, int> Eris::Meta::CompletedServerList

Emitted once the complete list of servers has been retrived from the metaserver.

Argument is the total number of servers in the list

sigc::signal<void, const std::string&> Eris::Meta::Failure

Indicates a failure (usually network related) has occurred.

The server list will be cleared, and the status set to INVALID.


The documentation for this class was generated from the following files:

Generated on Wed Sep 9 10:33:33 2009 for Eris by  doxygen 1.6.1