diff --git a/server/wsproxy/jsondatamgr.cc b/server/wsproxy/jsondatamgr.cc index f561c5b..6a3878e 100644 --- a/server/wsproxy/jsondatamgr.cc +++ b/server/wsproxy/jsondatamgr.cc @@ -20,6 +20,7 @@ void JsonDataMgr::Init() std::string wsproxy_cluster_json_file; std::string master_cluster_json_file; + std::string kcp_conf_json_file; wsproxy_cluster_json_file = a8::Format ("%s/node%d/game%d.wsproxy.cluster.json", { @@ -34,11 +35,29 @@ void JsonDataMgr::Init() App::Instance()->GetNodeId(), GAME_ID }); + kcp_conf_json_file = a8::Format + ("%s/kcp_conf.json", + { + work_path_, + }); wsproxy_cluster_json_.ReadFromFile(wsproxy_cluster_json_file); master_cluster_json_.ReadFromFile(master_cluster_json_file); + kcp_conf_json_.ReadFromFile(kcp_conf_json_file); udp_host_ = GetConf()->At("listen_udp_host")->AsXValue().GetString(); udp_port_ = GetConf()->At("listen_udp_port")->AsXValue(); + { + kcp_conf_.sndwnd = kcp_conf_json_.At("sndwnd")->AsXValue(); + kcp_conf_.rcvwnd = kcp_conf_json_.At("rcvwnd")->AsXValue(); + + kcp_conf_.nodelay = kcp_conf_json_.At("nodelay")->AsXValue(); + kcp_conf_.interval = kcp_conf_json_.At("interval")->AsXValue(); + kcp_conf_.resend = kcp_conf_json_.At("resend")->AsXValue(); + kcp_conf_.nc = kcp_conf_json_.At("nc")->AsXValue(); + + kcp_conf_.rx_minrto = kcp_conf_json_.At("rx_minrto")->AsXValue(); + kcp_conf_.fastresend = kcp_conf_json_.At("fastresend")->AsXValue(); + } } void JsonDataMgr::UnInit() diff --git a/server/wsproxy/jsondatamgr.h b/server/wsproxy/jsondatamgr.h index 255b8da..a71a73e 100644 --- a/server/wsproxy/jsondatamgr.h +++ b/server/wsproxy/jsondatamgr.h @@ -4,16 +4,16 @@ struct KcpConf { - int sndwnd = 128; - int rcvwnd = 128; + int sndwnd = 0; + int rcvwnd = 0; - int nodelay = 2; - int interval = 10; - int resend = 2; - int nc = 1; + int nodelay = 0; + int interval = 0; + int resend = 0; + int nc = 0; int rx_minrto = 0; - int fastresend = 1; + int fastresend = 0; }; class JsonDataMgr : public a8::Singleton @@ -36,6 +36,7 @@ class JsonDataMgr : public a8::Singleton 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_ = {};