Eris  1.4.0
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
Eris::Meta Class Reference

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

#include <Metaserver.h>

Inheritance diagram for Eris::Meta:

Public Types

enum  MetaStatus { INVALID = 0, VALID, GETTING_LIST, QUERYING }
 

Public Member Functions

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

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. More...
 
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. More...
 

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 query ()
 
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. More...
 
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.

Member Enumeration Documentation

◆ MetaStatus

Enumerator
INVALID 

The server list is not valid.

VALID 

The list is valid and completed.

GETTING_LIST 

Retrieving the list of game servers from the metaserver.

QUERYING 

Querying game servers for information.

Constructor & Destructor Documentation

◆ Meta()

Eris::Meta::Meta ( boost::asio::io_service &  io_service,
EventService eventService,
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
msvThe metaserver to query, specified as a hostname. Usually metaserver.worldforge.org, but that's up to you.
maxQueriesThe 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.

References disconnect().

Member Function Documentation

◆ cancel()

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(), INVALID, and VALID.

Referenced by disconnect().

◆ connect()

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(), and GETTING_LIST.

Referenced by refresh().

◆ getGameServerCount()

size_t Eris::Meta::getGameServerCount ( ) const

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

◆ getInfoForServer()

const ServerInfo & Eris::Meta::getInfoForServer ( size_t  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.

◆ refresh()

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(), disconnect(), and VALID.

Member Data Documentation

◆ CompletedServerList

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

Referenced by disconnect().

◆ Failure

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.

Referenced by disconnect().


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