45 lines
1018 B
C++
45 lines
1018 B
C++
#pragma once
|
|
|
|
namespace f8
|
|
{
|
|
struct MsgHdr;
|
|
}
|
|
|
|
namespace ss
|
|
{
|
|
class SS_MS_ResponseTargetServer;
|
|
}
|
|
|
|
class MasterSvr;
|
|
class MasterSvrMgr : public a8::Singleton<MasterSvrMgr>
|
|
{
|
|
public:
|
|
enum { HID = HID_MasterSvrMgr };
|
|
|
|
private:
|
|
MasterSvrMgr() {};
|
|
friend class a8::Singleton<MasterSvrMgr>;
|
|
|
|
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);
|
|
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);
|
|
MasterSvr* GetConnById(int instance_id);
|
|
|
|
private:
|
|
int target_conn_id_ = 100;
|
|
long long curr_context_id_ = 0;
|
|
std::map<int, MasterSvr*> mastersvr_hash_;
|
|
std::map<int, long long> pending_socket_hash_;
|
|
std::map<long long, f8::MsgHdr*> pending_request_hash_;
|
|
|
|
};
|