Eris  1.4.0
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 
8 namespace Eris {
9 
10 class Meta;
11 
20 class MetaQuery : public BaseConnection
21 {
22 public:
23  MetaQuery(boost::asio::io_service& io_service, Meta& svr, const std::string &host, size_t index);
24 
25  ~MetaQuery() override;
26 
28  long getQueryNo() const;
29 
30  size_t getServerIndex() const;
31 
33  long getElapsed();
34 
35  bool isComplete() const;
36 
37  friend class Meta;
38 protected:
39  void setComplete();
40 
42  void onConnect() override;
43 
44  void handleFailure(const std::string &msg) override;
45 
46  void handleTimeout(const std::string& msg) override;
47 
48  void onQueryTimeout();
49 
50  void dispatch() override;
51 
53 
54  long _queryNo;
55  WFMath::TimeStamp _stamp;
56  size_t m_serverIndex;
57  bool m_complete;
58  boost::asio::deadline_timer m_completeTimer;
59 };
60 
62 inline long MetaQuery::getQueryNo() const
63 {
64  return _queryNo;
65 }
66 
67 inline size_t MetaQuery::getServerIndex() const
68 {
69  return m_serverIndex;
70 }
71 
72 inline bool MetaQuery::isComplete() const
73 {
74  return m_complete;
75 }
76 
77 
78 } // of namespace
79 
80 #endif
Meta & _meta
The Meta-server object which owns the query.
Definition: MetaQuery.h:52
long _queryNo
The serial number of the query GET.
Definition: MetaQuery.h:54
long getElapsed()
Access the elapsed time (in millseconds) since the query was issued.
Definition: MetaQuery.cpp:72
void onConnect() override
Over-ride the default connection behaviour to issue the query.
Definition: MetaQuery.cpp:41
MetaQuery is a temporary connection used to retrieve information about a game server.
Definition: MetaQuery.h:20
Every Eris class and type lives inside the Eris namespace; certain utility functions live in the Util...
Definition: Account.cpp:34
WFMath::TimeStamp _stamp
Time stamp of the request, to estimate ping to server.
Definition: MetaQuery.h:55
void handleFailure(const std::string &msg) override
derived-class notification when a failure occurs
Definition: MetaQuery.cpp:77
Meta encapsulates the meta-game system, including the meta-server protocol and queries.
Definition: Metaserver.h:36
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: BaseConnection.h:36
long getQueryNo() const
return the serial-number of the query GET operation [for identification of replies] ...
Definition: MetaQuery.h:62