35 lines
956 B
C++
35 lines
956 B
C++
#pragma once
|
|
|
|
#include <f8/timer.h>
|
|
|
|
class DownStream;
|
|
struct PendingAccount;
|
|
class DownStreamMgr : public a8::Singleton<DownStreamMgr>
|
|
{
|
|
private:
|
|
DownStreamMgr() {};
|
|
friend class a8::Singleton<DownStreamMgr>;
|
|
|
|
public:
|
|
|
|
void Init();
|
|
void UnInit();
|
|
|
|
void OnUpStreamDisconnect(int instance_id);
|
|
void OnUpStreamConnect(int instance_id);
|
|
std::weak_ptr<DownStream> GetGameClientBySocket(int sockhande);
|
|
void BindUpStream(int socket_handle, int conn_instance_id);
|
|
void AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick);
|
|
|
|
private:
|
|
|
|
void OnClientDisconnect(int socket_handle);
|
|
std::shared_ptr<PendingAccount> GetPendingAccount(int socket_handle);
|
|
void RemovePendingAccount(int socket_handle);
|
|
|
|
private:
|
|
f8::Attacher timer_attacher_;
|
|
std::map<int, std::shared_ptr<DownStream>> socket_hash_;
|
|
std::map<int, std::shared_ptr<PendingAccount>> pending_account_hash_;
|
|
};
|