eris
1.4.0
A WorldForge client library.
|
Meta encapsulates the meta-game system, including the meta-server protocol and queries. More...
#include <Metaserver.h>
Public Types | |
enum | MetaStatus { INVALID = 0, VALID, GETTING_LIST, QUERYING } |
Public Member Functions | |
Meta (boost::asio::io_service &io_service, EventService &eventService, std::string msv, unsigned int maxQueries) | |
size_t | getGameServerCount () const |
const ServerInfo & | getInfoForServer (size_t index) const |
void | queryServerByIndex (size_t index) |
Query a specific game server; emits a signal when complete. More... | |
void | refresh () |
void | cancel () |
void | dispatch () |
MetaStatus | getStatus () const |
Public Attributes | |
sigc::signal< void, const ServerInfo & > | ReceivedServerInfo |
Emitted when information about a server is received. More... | |
sigc::signal< void, int > | CompletedServerList |
sigc::signal< void > | AllQueriesDone |
Emitted when the entire server list has been refreshed. More... | |
sigc::signal< void, const std::string & > | Failure |
Protected Member Functions | |
void | objectArrived (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 () |
void | disconnect () |
Friends | |
struct | MetaDecoder |
class | MetaQuery |
Meta encapsulates the meta-game system, including the meta-server protocol and queries.
Definition at line 39 of file Metaserver.h.
Definition at line 42 of file Metaserver.h.
Eris::Meta::Meta | ( | boost::asio::io_service & | io_service, |
EventService & | eventService, | ||
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.
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. |
Definition at line 71 of file Metaserver.cpp.
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.
Definition at line 159 of file Metaserver.cpp.
References disconnect(), INVALID, and VALID.
|
protected |
initiate a connection to the meta-server : this will issue a keep-alive followed by a list request.
Definition at line 189 of file Metaserver.cpp.
References disconnect().
Referenced by refresh().
|
protected |
tear down an existing connection to the server
Definition at line 222 of file Metaserver.cpp.
size_t Eris::Meta::getGameServerCount | ( | ) | const |
Return the total number of game servers the meta server knows about.
Definition at line 185 of file Metaserver.cpp.
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.
Definition at line 175 of file Metaserver.cpp.
void Eris::Meta::queryServerByIndex | ( | size_t | index | ) |
Query a specific game server; emits a signal when complete.
Definition at line 123 of file Metaserver.cpp.
References INVALID.
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.
Definition at line 142 of file Metaserver.cpp.
References connect(), disconnect(), and VALID.
sigc::signal<void> Eris::Meta::AllQueriesDone |
Emitted when the entire server list has been refreshed.
Definition at line 111 of file Metaserver.h.
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
Definition at line 108 of file Metaserver.h.
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.
Definition at line 117 of file Metaserver.h.
sigc::signal<void, const ServerInfo&> Eris::Meta::ReceivedServerInfo |
Emitted when information about a server is received.
Definition at line 102 of file Metaserver.h.