1
This commit is contained in:
parent
89816f516a
commit
71175471e1
@ -12,6 +12,14 @@
|
||||
#include "GCListener.h"
|
||||
#include "app.h"
|
||||
|
||||
struct PendingAccount
|
||||
{
|
||||
int socket_handle = 0;
|
||||
std::string account_id;
|
||||
long long add_tick = 0;
|
||||
f8::TimerWp timer_wp;
|
||||
};
|
||||
|
||||
void DownStreamMgr::Init()
|
||||
{
|
||||
f8::MsgQueue::Instance()->RegisterCallBack
|
||||
@ -27,9 +35,7 @@ void DownStreamMgr::Init()
|
||||
void DownStreamMgr::UnInit()
|
||||
{
|
||||
socket_hash_.clear();
|
||||
#if 0
|
||||
pending_account_hash_.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DownStreamMgr::OnClientDisconnect(int socket_handle)
|
||||
@ -90,26 +96,17 @@ void DownStreamMgr::BindUpStream(int socket_handle, int conn_instance_id)
|
||||
socket_hash_[down->socket_handle] = down;
|
||||
f8::UdpLog::Instance()->Info("BindUpStream socket_handle:%d", {socket_handle});
|
||||
{
|
||||
#if 0
|
||||
auto itr = pending_account_hash_.find(socket_handle);
|
||||
if (itr != pending_account_hash_.end()) {
|
||||
std::string account_id = std::get<0>(itr->second);
|
||||
long long req_tick = std::get<1>(itr->second);
|
||||
if (auto pending_account = GetPendingAccount(socket_handle)) {
|
||||
long long cur_tick = a8::XGetTickCount();
|
||||
if (cur_tick - req_tick > App::Instance()->perf.max_join_time) {
|
||||
App::Instance()->perf.max_join_time = cur_tick - req_tick;
|
||||
if (cur_tick - pending_account->add_tick > App::Instance()->perf.max_join_time) {
|
||||
App::Instance()->perf.max_join_time = cur_tick - pending_account->add_tick;
|
||||
}
|
||||
if (account_id == azw_account_id) {
|
||||
f8::UdpLog::Instance()->Info("%s join time:%d",
|
||||
{
|
||||
account_id,
|
||||
cur_tick - req_tick
|
||||
});
|
||||
}
|
||||
f8::UdpLog::Instance()->Info("BindUpStream account_id:%s", {account_id});
|
||||
f8::UdpLog::Instance()->Info("BindUpStream account_id:%s",
|
||||
{
|
||||
pending_account->account_id
|
||||
});
|
||||
RemovePendingAccount(socket_handle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,16 +138,20 @@ void DownStreamMgr::AddPendingAccount(const std::string& account_id, int socket_
|
||||
#endif
|
||||
}
|
||||
|
||||
std::shared_ptr<PendingAccount> DownStreamMgr::GetPendingAccount(int socket_handle)
|
||||
{
|
||||
auto itr = pending_account_hash_.find(socket_handle);
|
||||
return itr != pending_account_hash_.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
void DownStreamMgr::RemovePendingAccount(int socket_handle)
|
||||
{
|
||||
#if 0
|
||||
f8::UdpLog::Instance()->Info("RemovePendingAccount %d", {socket_handle});
|
||||
auto itr = pending_account_hash_.find(socket_handle);
|
||||
if (itr != pending_account_hash_.end()) {
|
||||
#if 0
|
||||
f8::Timer::Instance()->DeleteTimer(std::get<2>(itr->second));
|
||||
if (!itr->second->timer_wp.expired()) {
|
||||
f8::Timer::Instance()->Delete(itr->second->timer_wp);
|
||||
}
|
||||
pending_account_hash_.erase(itr);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <f8/timer.h>
|
||||
|
||||
class DownStream;
|
||||
struct PendingAccount;
|
||||
class DownStreamMgr : public a8::Singleton<DownStreamMgr>
|
||||
{
|
||||
private:
|
||||
@ -25,12 +26,11 @@ class DownStreamMgr : public a8::Singleton<DownStreamMgr>
|
||||
private:
|
||||
|
||||
void OnClientDisconnect(int socket_handle);
|
||||
std::shared_ptr<PendingAccount> GetPendingAccount(int socket_handle);
|
||||
void RemovePendingAccount(int socket_handle);
|
||||
|
||||
private:
|
||||
a8::Attacher timer_attacher_;
|
||||
std::map<int, std::shared_ptr<DownStream>> socket_hash_;
|
||||
#if 0
|
||||
std::map<int, std::tuple<std::string, long long, timer_list*>> pending_account_hash_;
|
||||
#endif
|
||||
std::map<int, std::shared_ptr<PendingAccount>> pending_account_hash_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user