1
This commit is contained in:
parent
a490983b75
commit
5587c3c85c
@ -82,3 +82,14 @@ std::shared_ptr<a8::XObject> JsonDataMgr::GetMasterServerClusterConf()
|
||||
{
|
||||
return std::make_shared<a8::XObject>(masterserver_cluster_json_);
|
||||
}
|
||||
|
||||
void JsonDataMgr::TraverseMaster(std::function<void (int, std::string, int)> cb)
|
||||
{
|
||||
for (int i = 0; i < masterserver_cluster_json_.Size(); ++i) {
|
||||
auto master_svr_conf = masterserver_cluster_json_.At(i);
|
||||
int instance_id = master_svr_conf->At("instance_id")->AsXValue();
|
||||
std::string remote_ip = master_svr_conf->At("ip")->AsXValue();
|
||||
int remote_port = master_svr_conf->At("port")->AsXValue();
|
||||
cb(instance_id, remote_ip, remote_port);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
|
||||
|
||||
std::shared_ptr<a8::XObject> GetConf();
|
||||
std::shared_ptr<a8::XObject> GetMasterServerClusterConf();
|
||||
void TraverseMaster(std::function<void (int, std::string, int)> cb);
|
||||
std::string GetUdpHost() { return udp_host_; }
|
||||
int GetUdpPort() { return udp_port_; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user