50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
#pragma once
|
|
|
|
namespace f8
|
|
{
|
|
struct MsgHdr;
|
|
}
|
|
|
|
namespace ss
|
|
{
|
|
class SS_MS_ResponseTargetServer;
|
|
}
|
|
|
|
class Master;
|
|
class MasterMgr : public a8::Singleton<MasterMgr>
|
|
{
|
|
public:
|
|
enum { HID = HID_MasterMgr };
|
|
|
|
private:
|
|
MasterMgr() {};
|
|
friend class a8::Singleton<MasterMgr>;
|
|
|
|
public:
|
|
|
|
void Init();
|
|
void UnInit();
|
|
|
|
void _SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_ResponseTargetServer& msg);
|
|
void RequestTargetServer(f8::MsgHdr& hdr,
|
|
const std::string& team_id,
|
|
const std::string& account_id,
|
|
const std::string& server_info,
|
|
int is_reconnect,
|
|
int proto_version);
|
|
void RemoveRequest(int socket_handle, long long context_id, bool auto_free);
|
|
|
|
private:
|
|
long long GetContextIdBySocket(int socket_handle);
|
|
f8::MsgHdr* GetHdrByContextId(long long context_id);
|
|
Master* GetConnById(int instance_id);
|
|
|
|
private:
|
|
int target_conn_id_ = 100;
|
|
long long curr_context_id_ = 0;
|
|
std::map<int, Master*> mastersvr_hash_;
|
|
std::map<int, long long> pending_socket_hash_;
|
|
std::map<long long, f8::MsgHdr*> pending_request_hash_;
|
|
|
|
};
|