1
This commit is contained in:
parent
97ce74378d
commit
a30e4be78c
@ -15,6 +15,8 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
|
|||||||
std::shared_ptr<a8::XObject> GetConf();
|
std::shared_ptr<a8::XObject> GetConf();
|
||||||
std::shared_ptr<a8::XObject> GetMasterServerClusterConf();
|
std::shared_ptr<a8::XObject> GetMasterServerClusterConf();
|
||||||
bool GetNodeHost(int node_id, std::string& host);
|
bool GetNodeHost(int node_id, std::string& host);
|
||||||
|
std::string GetUdpHost() { return udp_host_; }
|
||||||
|
int GetUdpPort() { return udp_port_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string work_path_ = "../config";
|
std::string work_path_ = "../config";
|
||||||
@ -23,4 +25,6 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
|
|||||||
std::mutex* node_host_mutex_ = nullptr;
|
std::mutex* node_host_mutex_ = nullptr;
|
||||||
a8::XObject routing_tables_json_;
|
a8::XObject routing_tables_json_;
|
||||||
std::map<int, std::string> node_host_hash_;
|
std::map<int, std::string> node_host_hash_;
|
||||||
|
std::string udp_host_;
|
||||||
|
int udp_port_ = 0;
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ void LongSessionMgr::Init()
|
|||||||
udp_listener_->on_recv_packet = GSUdpListeneron_recv_packet;
|
udp_listener_->on_recv_packet = GSUdpListeneron_recv_packet;
|
||||||
|
|
||||||
udp_listener_->bind_address = "0.0.0.0";
|
udp_listener_->bind_address = "0.0.0.0";
|
||||||
udp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_udp_port")->AsXValue();
|
udp_listener_->bind_port = JsonDataMgr::Instance()->GetUdpPort();
|
||||||
udp_listener_->Open();
|
udp_listener_->Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +68,8 @@ void LongSessionMgr::_SS_CMKcpHandshake(f8::MsgHdr& hdr, const ss::SS_CMKcpHands
|
|||||||
long long secret_key = session->GetKcpSession()->GetSecretKey();
|
long long secret_key = session->GetKcpSession()->GetSecretKey();
|
||||||
respmsg.set_secret_key(&secret_key, sizeof(secret_key));
|
respmsg.set_secret_key(&secret_key, sizeof(secret_key));
|
||||||
}
|
}
|
||||||
|
respmsg.set_remote_host(JsonDataMgr::Instance()->GetUdpHost());
|
||||||
|
respmsg.set_remote_port(JsonDataMgr::Instance()->GetUdpPort());
|
||||||
GCListener::Instance()->SendMsg(hdr.socket_handle, respmsg);
|
GCListener::Instance()->SendMsg(hdr.socket_handle, respmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user