1
This commit is contained in:
parent
91cd2a33ec
commit
68bc02f627
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "framework/cpp/netmsghandler.h"
|
#include "framework/cpp/netmsghandler.h"
|
||||||
|
|
||||||
|
const char* azw_account_id = "6001_2001_oJqfX5c4pvW-wlarmcrvEO6BQjd8";
|
||||||
|
|
||||||
void MasterSvrMgr::Init()
|
void MasterSvrMgr::Init()
|
||||||
{
|
{
|
||||||
curr_context_id_ = a8::MakeInt64(0, time(nullptr) + 1000 * 60 * 10);
|
curr_context_id_ = a8::MakeInt64(0, time(nullptr) + 1000 * 60 * 10);
|
||||||
@ -56,11 +58,6 @@ void MasterSvrMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_
|
|||||||
auto_free = false;
|
auto_free = false;
|
||||||
conn->ForwardClientMsgEx(context_hdr);
|
conn->ForwardClientMsgEx(context_hdr);
|
||||||
}
|
}
|
||||||
long long req_tick = (long long)hdr.hum;
|
|
||||||
long long req_handle_time = a8::XGetTickCount() - req_tick;
|
|
||||||
if (req_handle_time > App::Instance()->perf.max_login_time) {
|
|
||||||
App::Instance()->perf.max_login_time = req_handle_time;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RemoveRequest(socket_handle, msg.context_id(), auto_free);
|
RemoveRequest(socket_handle, msg.context_id(), auto_free);
|
||||||
}
|
}
|
||||||
@ -98,7 +95,6 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr, const std::string& team_
|
|||||||
a8::TimerAttacher* timer_attacher = new a8::TimerAttacher();
|
a8::TimerAttacher* timer_attacher = new a8::TimerAttacher();
|
||||||
f8::MsgHdr* new_hdr = hdr.Clone();
|
f8::MsgHdr* new_hdr = hdr.Clone();
|
||||||
new_hdr->user_data = timer_attacher;
|
new_hdr->user_data = timer_attacher;
|
||||||
new_hdr->hum = (Player*)a8::XGetTickCount();
|
|
||||||
|
|
||||||
ss::SS_WSP_RequestTargetServer msg;
|
ss::SS_WSP_RequestTargetServer msg;
|
||||||
msg.set_context_id(curr_context_id_);
|
msg.set_context_id(curr_context_id_);
|
||||||
@ -108,19 +104,50 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr, const std::string& team_
|
|||||||
pending_socket_hash_[hdr.socket_handle] = curr_context_id_;
|
pending_socket_hash_[hdr.socket_handle] = curr_context_id_;
|
||||||
assert(pending_request_hash_.find(curr_context_id_) == pending_request_hash_.end());
|
assert(pending_request_hash_.find(curr_context_id_) == pending_request_hash_.end());
|
||||||
pending_request_hash_[curr_context_id_] = new_hdr;
|
pending_request_hash_[curr_context_id_] = new_hdr;
|
||||||
|
if (account_id == azw_account_id) {
|
||||||
|
a8::UdpLog::Instance()->Info("%s request", {account_id});
|
||||||
|
}
|
||||||
|
auto timer_func =
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
if (param.param2.GetString() == azw_account_id) {
|
||||||
|
a8::UdpLog::Instance()->Info("%s timeout",
|
||||||
|
{
|
||||||
|
param.param2.GetString()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
a8::Timer::Instance()->RemoveTimerFunc(a8::Timer::Instance()->GetRunningTimer());
|
||||||
|
MasterSvrMgr::Instance()->RemoveRequest(
|
||||||
|
param.param1,
|
||||||
|
param.sender,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
auto timer_after_func =
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
if (param.param2.GetString() == azw_account_id) {
|
||||||
|
a8::UdpLog::Instance()->Info("%s response time:%d",
|
||||||
|
{
|
||||||
|
param.param2.GetString(),
|
||||||
|
a8::XGetTickCount() - param.param3.GetInt64()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
long long req_handle_time = a8::XGetTickCount() - param.param3.GetInt64();
|
||||||
|
if (req_handle_time > App::Instance()->perf.max_login_time) {
|
||||||
|
App::Instance()->perf.max_login_time = req_handle_time;
|
||||||
|
}
|
||||||
|
};
|
||||||
a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10,
|
a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10,
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
.SetSender(curr_context_id_)
|
.SetSender(curr_context_id_)
|
||||||
.SetParam1(hdr.socket_handle),
|
.SetParam1(hdr.socket_handle)
|
||||||
[] (const a8::XParams& param)
|
.SetParam2(account_id)
|
||||||
{
|
.SetParam3(a8::XGetTickCount()),
|
||||||
MasterSvrMgr::Instance()->RemoveRequest(
|
timer_func,
|
||||||
param.param1,
|
&timer_attacher->timer_list_,
|
||||||
param.sender,
|
timer_after_func
|
||||||
true
|
);
|
||||||
);
|
|
||||||
},
|
|
||||||
&timer_attacher->timer_list_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
third_party/a8engine
vendored
2
third_party/a8engine
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9a8d93e085ee2ce420010501c2a1397aece62269
|
Subproject commit cd38d3a5ff77831d675fd7accd90a38992a294c8
|
Loading…
x
Reference in New Issue
Block a user