47 lines
973 B
C++
47 lines
973 B
C++
#pragma once
|
|
|
|
#include <a8/singleton.h>
|
|
|
|
struct KcpConf
|
|
{
|
|
int open = 0;
|
|
|
|
int sndwnd = 0;
|
|
int rcvwnd = 0;
|
|
|
|
int nodelay = 0;
|
|
int interval = 0;
|
|
int resend = 0;
|
|
int nc = 0;
|
|
|
|
int rx_minrto = 0;
|
|
int fastresend = 0;
|
|
};
|
|
|
|
class JsonDataMgr : public a8::Singleton<JsonDataMgr>
|
|
{
|
|
private:
|
|
JsonDataMgr() {};
|
|
friend class a8::Singleton<JsonDataMgr>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
|
|
std::string GetUdpHost() { return udp_host_; }
|
|
int GetUdpPort() { return udp_port_; }
|
|
std::shared_ptr<a8::XObject> GetConf();
|
|
void TraverseMaster(std::function<void (int, std::string, int)> cb);
|
|
const KcpConf& GetKcpConf() { return kcp_conf_; }
|
|
void SetKcpSwitch(int is_open);
|
|
|
|
private:
|
|
std::string work_path_ = "../config";
|
|
a8::XObject wsproxy_cluster_json_;
|
|
a8::XObject master_cluster_json_;
|
|
a8::XObject kcp_conf_json_;
|
|
std::string udp_host_;
|
|
int udp_port_ = 0;
|
|
KcpConf kcp_conf_ = {};
|
|
};
|