eris
1.4.0
A WorldForge client library.
|
#include <MetaQuery.h>
Public Types | |
enum | Status { INVALID_STATUS = 0, NEGOTIATE, CONNECTING, CONNECTED, DISCONNECTED, DISCONNECTING, QUERY_GET } |
possible states for the connection More... | |
Public Member Functions | |
MetaQuery (boost::asio::io_service &io_service, Atlas::Bridge &bridge, Meta &meta, const std::string &host, size_t index) | |
std::int64_t | getQueryNo () const |
return the serial-number of the query GET operation [for identification of replies] More... | |
size_t | getServerIndex () const |
long | getElapsed () |
Access the elapsed time (in millseconds) since the query was issued. More... | |
bool | isComplete () const |
virtual int | connectRemote (const std::string &host, short port) |
virtual int | connectLocal (const std::string &socket) |
Status | getStatus () const |
get the current status of the connection More... | |
bool | isConnected () const |
Ascertain whether or not the connection is usable for transport. More... | |
const std::string & | getHost () const |
short | getPort () const |
Atlas::Objects::Factories & | getFactories () |
const Atlas::Objects::Factories & | getFactories () const |
Public Attributes | |
sigc::signal< void > | Connected |
sent on successful negotiation of a game server connection More... | |
sigc::signal< void > | Disconnected |
final disconnect (or hard disocnnect) notifcation More... | |
Protected Member Functions | |
void | setComplete () |
void | onConnect () override |
Over-ride the default connection behaviour to issue the query. More... | |
void | handleFailure (const std::string &msg) override |
derived-class notification when a failure occurs More... | |
void | handleTimeout (const std::string &msg) override |
void | onQueryTimeout () |
void | dispatch () override |
void | stateChanged (StreamSocket::Status status) |
virtual void | setStatus (Status sc) |
update the connection status and generate signals More... | |
void | onConnectTimeout () |
void | onNegotiateTimeout () |
void | hardDisconnect (bool emit) |
Protected Attributes | |
Meta & | _meta |
The Meta-server object which owns the query. More... | |
std::int64_t | _queryNo |
The serial number of the query GET. More... | |
WFMath::TimeStamp | _stamp |
Time stamp of the request, to estimate ping to server. More... | |
size_t | m_serverIndex |
bool | m_complete |
boost::asio::steady_timer | m_completeTimer |
boost::asio::io_service & | _io_service |
std::unique_ptr< Atlas::Objects::Factories > | _factories |
std::shared_ptr< StreamSocket > | _socket |
Status | _status |
current status of the connection More... | |
const std::string | _id |
a unique identifier for this connection More... | |
std::string | _clientName |
the client identified used during connection More... | |
Atlas::Bridge * | _bridge |
std::string | _host |
the host name we're connected to More... | |
short | _port |
the port we're connected to More... | |
Friends | |
class | Meta |
MetaQuery is a temporary connection used to retrieve information about a game server. It issues an anoymous GET operation, and expects to receive an INFO operation containing a 'server' entity in response. This entity contains attributes such as the ruleset, uptime, number of connectec players and so on. In addition, MetaQuery tracks the time the server takes to response, and this estimates the server's ping. This time also includes server latency.
Definition at line 20 of file MetaQuery.h.
|
inherited |
possible states for the connection
Definition at line 55 of file BaseConnection.h.
|
virtualinherited |
Try to connect to a local socket.
Definition at line 98 of file BaseConnection.cpp.
References Eris::BaseConnection::_bridge, Eris::BaseConnection::_clientName, Eris::BaseConnection::_host, Eris::BaseConnection::CONNECTED, Eris::StreamSocket::CONNECTED, Eris::BaseConnection::CONNECTING, Eris::StreamSocket::CONNECTING, Eris::StreamSocket::CONNECTING_FAILED, Eris::StreamSocket::CONNECTING_TIMEOUT, Eris::StreamSocket::CONNECTION_FAILED, Eris::BaseConnection::DISCONNECTING, Eris::StreamSocket::DISCONNECTING, Eris::StreamSocket::Callbacks::dispatch, Eris::BaseConnection::handleFailure(), Eris::BaseConnection::hardDisconnect(), Eris::BaseConnection::NEGOTIATE, Eris::StreamSocket::NEGOTIATE, Eris::StreamSocket::NEGOTIATE_FAILED, Eris::StreamSocket::NEGOTIATE_TIMEOUT, Eris::BaseConnection::onConnect(), Eris::BaseConnection::setStatus(), and Eris::StreamSocket::Callbacks::stateChanged.
Referenced by Eris::Connection::connect().
|
virtualinherited |
open a connection to the specified host/port; invokes the failure handler if the connection could not be opened.
Definition at line 65 of file BaseConnection.cpp.
References Eris::BaseConnection::_bridge, Eris::BaseConnection::_clientName, Eris::BaseConnection::CONNECTING, Eris::StreamSocket::Callbacks::dispatch, Eris::BaseConnection::hardDisconnect(), Eris::StreamSocket::NEGOTIATE, Eris::BaseConnection::setStatus(), and Eris::StreamSocket::Callbacks::stateChanged.
Referenced by Eris::Connection::connect().
long Eris::MetaQuery::getElapsed | ( | ) |
Access the elapsed time (in millseconds) since the query was issued.
Definition at line 68 of file MetaQuery.cpp.
|
inherited |
Gets the host of the connection.
Definition at line 203 of file BaseConnection.cpp.
References Eris::BaseConnection::_host.
|
inherited |
Gets the port of the connection.
Definition at line 208 of file BaseConnection.cpp.
References Eris::BaseConnection::_port.
|
inline |
return the serial-number of the query GET operation [for identification of replies]
Definition at line 66 of file MetaQuery.h.
References _queryNo.
|
inlineinherited |
get the current status of the connection
Definition at line 68 of file BaseConnection.h.
Referenced by Eris::Account::isLoggedIn().
|
overrideprotectedvirtual |
derived-class notification when a failure occurs
Implements Eris::BaseConnection.
Definition at line 72 of file MetaQuery.cpp.
|
protectedinherited |
performs and instant disconnection from the server specified whether the change of state should be signalled
Definition at line 162 of file BaseConnection.cpp.
References Eris::BaseConnection::_status, Eris::BaseConnection::DISCONNECTED, Eris::BaseConnection::Disconnected, and Eris::BaseConnection::setStatus().
Referenced by Eris::Connection::Connection(), Eris::BaseConnection::connectLocal(), Eris::BaseConnection::connectRemote(), Eris::Connection::disconnect(), Eris::BaseConnection::onConnect(), Eris::Connection::onConnect(), Eris::Connection::send(), Eris::Connection::unlock(), and Eris::BaseConnection::~BaseConnection().
|
inlineinherited |
Ascertain whether or not the connection is usable for transport.
Definition at line 72 of file BaseConnection.h.
Referenced by Eris::Account::createAccount(), Eris::Account::createCharacterThroughEntity(), Eris::Room::createRoom(), Eris::Room::emote(), Eris::Room::leave(), Eris::Account::login(), Eris::Account::logout(), Eris::Person::msg(), Eris::Account::refreshCharacterInfo(), Eris::Room::say(), Eris::Account::takeCharacter(), and Eris::Account::takeTransferredCharacter().
|
overrideprotectedvirtual |
Over-ride the default connection behaviour to issue the query.
Reimplemented from Eris::BaseConnection.
Definition at line 40 of file MetaQuery.cpp.
References Eris::getNewSerialno().
|
protectedvirtualinherited |
update the connection status and generate signals
Reimplemented in Eris::Connection.
Definition at line 198 of file BaseConnection.cpp.
References Eris::BaseConnection::_status.
Referenced by Eris::BaseConnection::connectLocal(), Eris::BaseConnection::connectRemote(), and Eris::BaseConnection::hardDisconnect().
|
protectedinherited |
the connection bridge (i.e something implementing objectArrived()) : this can be the derived class itself, or any other object
Definition at line 139 of file BaseConnection.h.
Referenced by Eris::Connection::Connection(), Eris::BaseConnection::connectLocal(), and Eris::BaseConnection::connectRemote().
|
protectedinherited |
the client identified used during connection
Definition at line 135 of file BaseConnection.h.
Referenced by Eris::BaseConnection::connectLocal(), and Eris::BaseConnection::connectRemote().
|
protectedinherited |
the host name we're connected to
Definition at line 141 of file BaseConnection.h.
Referenced by Eris::BaseConnection::connectLocal(), Eris::BaseConnection::getHost(), and Eris::BaseConnection::onConnect().
|
protectedinherited |
a unique identifier for this connection
Definition at line 133 of file BaseConnection.h.
|
protected |
The Meta-server object which owns the query.
Definition at line 56 of file MetaQuery.h.
|
protectedinherited |
the port we're connected to
Definition at line 142 of file BaseConnection.h.
Referenced by Eris::BaseConnection::getPort(), and Eris::BaseConnection::onConnect().
|
protected |
The serial number of the query GET.
Definition at line 58 of file MetaQuery.h.
Referenced by getQueryNo().
|
protected |
Time stamp of the request, to estimate ping to server.
Definition at line 59 of file MetaQuery.h.
|
protectedinherited |
current status of the connection
Definition at line 132 of file BaseConnection.h.
Referenced by Eris::Connection::disconnect(), Eris::BaseConnection::hardDisconnect(), Eris::Connection::refreshServerInfo(), Eris::Connection::send(), Eris::BaseConnection::setStatus(), Eris::Connection::setStatus(), Eris::Connection::unlock(), and Eris::BaseConnection::~BaseConnection().
|
inherited |
sent on successful negotiation of a game server connection
Definition at line 95 of file BaseConnection.h.
Referenced by Eris::Account::Account(), and Eris::BaseConnection::onConnect().
|
inherited |
final disconnect (or hard disocnnect) notifcation
Definition at line 98 of file BaseConnection.h.
Referenced by Eris::BaseConnection::hardDisconnect().