eris 1.4.0
A WorldForge client library.
MetaQuery.h
1#ifndef ERIS_META_QUERY_H
2#define ERIS_META_QUERY_H
3
4#include "BaseConnection.h"
5
6#include <wfmath/timestamp.h>
7
8namespace Eris {
9
10class Meta;
11
20class MetaQuery : public BaseConnection {
21public:
22 MetaQuery(boost::asio::io_service& io_service,
23 Atlas::Bridge& bridge,
24 Meta& meta,
25 const std::string& host,
26 size_t index);
27
28 ~MetaQuery() override;
29
31 std::int64_t getQueryNo() const;
32
33 size_t getServerIndex() const;
34
36 long getElapsed();
37
38 bool isComplete() const;
39
40 friend class Meta;
41
42protected:
43 void setComplete();
44
46 void onConnect() override;
47
48 void handleFailure(const std::string& msg) override;
49
50 void handleTimeout(const std::string& msg) override;
51
52 void onQueryTimeout();
53
54 void dispatch() override;
55
57
58 std::int64_t _queryNo;
59 WFMath::TimeStamp _stamp;
60 size_t m_serverIndex;
61 bool m_complete;
62 boost::asio::steady_timer m_completeTimer;
63};
64
66inline std::int64_t MetaQuery::getQueryNo() const {
67 return _queryNo;
68}
69
70inline size_t MetaQuery::getServerIndex() const {
71 return m_serverIndex;
72}
73
74inline bool MetaQuery::isComplete() const {
75 return m_complete;
76}
77
78
79} // of namespace
80
81#endif
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
void onConnect() override
Over-ride the default connection behaviour to issue the query.
Definition: MetaQuery.cpp:40
std::int64_t getQueryNo() const
return the serial-number of the query GET operation [for identification of replies]
Definition: MetaQuery.h:66
Meta & _meta
The Meta-server object which owns the query.
Definition: MetaQuery.h:56
WFMath::TimeStamp _stamp
Time stamp of the request, to estimate ping to server.
Definition: MetaQuery.h:59
long getElapsed()
Access the elapsed time (in millseconds) since the query was issued.
Definition: MetaQuery.cpp:68
void handleFailure(const std::string &msg) override
derived-class notification when a failure occurs
Definition: MetaQuery.cpp:72
std::int64_t _queryNo
The serial number of the query GET.
Definition: MetaQuery.h:58
Meta encapsulates the meta-game system, including the meta-server protocol and queries.
Definition: Metaserver.h:39
Definition: Account.cpp:33