This commit is contained in:
azw 2023-04-09 09:14:57 +00:00
parent 71175471e1
commit 06cd9f5018
3 changed files with 23 additions and 27 deletions

View File

@ -436,12 +436,6 @@ void App::ProcessIMMsg()
while (im_work_node_) {
IMMsgNode *pdelnode = im_work_node_;
switch (im_work_node_->msgid) {
case IM_ClientSocketDisconnect:
{
DownStreamMgr::Instance()->OnClientDisconnect(pdelnode->params);
MasterMgr::Instance()->RemoveRequest(pdelnode->params.param1, pdelnode->params.sender, true);
}
break;
case IM_UpStreamConnect:
{
DownStreamMgr::Instance()->OnTargetServerConnect(pdelnode->params);

View File

@ -49,6 +49,9 @@ void DownStreamMgr::OnClientDisconnect(int socket_handle)
socket_hash_.erase(socket_handle);
}
RemovePendingAccount(socket_handle);
#if 0
MasterMgr::Instance()->RemoveRequest(pdelnode->params.param1, pdelnode->params.sender, true);
#endif
}
#if 0
@ -114,28 +117,27 @@ void DownStreamMgr::BindUpStream(int socket_handle, int conn_instance_id)
void DownStreamMgr::AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick)
{
#if 0
f8::UdpLog::Instance()->Info("AddPendingAccount %s %d", {account_id, socket_handle});
auto itr = pending_account_hash_.find(socket_handle);
if (itr == pending_account_hash_.end()){
timer_list* timer = a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10,
a8::XParams()
.SetSender(socket_handle),
[] (const a8::XParams& param)
{
DownStreamMgr::Instance()->pending_account_hash_.erase(param.sender);
App::Instance()->perf.max_join_time = std::max((long long)1000 * 10, App::Instance()->perf.max_join_time);
},
&timer_attacher_.timer_list_
);
pending_account_hash_[socket_handle] = std::make_tuple(
account_id,
req_tick,
timer
);
if (!GetPendingAccount(socket_handle)){
auto timer_wp = f8::Timer::Instance()->SetTimeoutWpEx
(
1000 * 10,
[this, socket_handle] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
pending_account_hash_.erase(socket_handle);
App::Instance()->perf.max_join_time = std::max((long long)1000 * 10, App::Instance()->perf.max_join_time);
}
},
&timer_attacher_
);
auto p = std::make_shared<PendingAccount>();
p->socket_handle = socket_handle;
p->account_id = account_id;
p->add_tick = req_tick;
p->timer_wp = timer_wp;
pending_account_hash_[socket_handle] = p;
}
#endif
}
std::shared_ptr<PendingAccount> DownStreamMgr::GetPendingAccount(int socket_handle)

View File

@ -30,7 +30,7 @@ private:
void RemovePendingAccount(int socket_handle);
private:
a8::Attacher timer_attacher_;
f8::Attacher timer_attacher_;
std::map<int, std::shared_ptr<DownStream>> socket_hash_;
std::map<int, std::shared_ptr<PendingAccount>> pending_account_hash_;
};