修复宕机问题
This commit is contained in:
parent
86bff0cb84
commit
a9194a80af
@ -15,7 +15,6 @@ enum InnerMesssage_e
|
||||
IM_TargetConnDisconnect,
|
||||
IM_MasterSvrDisconnect,
|
||||
IM_TargetConnConnect,
|
||||
IM_RequestTargetServerTimeout
|
||||
};
|
||||
|
||||
//网络处理对象
|
||||
|
@ -45,6 +45,7 @@ void MasterSvrMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_
|
||||
f8::MsgHdr* context_hdr = GetHdrByContextId(msg.context_id());
|
||||
if (context_hdr) {
|
||||
bool auto_free = true;
|
||||
int socket_handle = context_hdr->socket_handle;
|
||||
if (msg.error_code() == 0) {
|
||||
TargetConn* conn = TargetConnMgr::Instance()->RecreateTargetConn(
|
||||
msg.host(),
|
||||
@ -56,7 +57,7 @@ void MasterSvrMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_
|
||||
conn->ForwardClientMsgEx(context_hdr);
|
||||
}
|
||||
}
|
||||
RemoveRequest(context_hdr->socket_handle, msg.context_id(), auto_free);
|
||||
RemoveRequest(socket_handle, msg.context_id(), auto_free);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,10 +108,11 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr, const std::string& team_
|
||||
.SetParam1(hdr.socket_handle),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
App::Instance()->AddIMMsg(IM_RequestTargetServerTimeout,
|
||||
a8::XParams()
|
||||
.SetSender(param.sender)
|
||||
.SetParam1(param.param1));
|
||||
MasterSvrMgr::Instance()->RemoveRequest(
|
||||
param.param1,
|
||||
param.sender,
|
||||
true
|
||||
);
|
||||
},
|
||||
&timer_attacher->timer_list_);
|
||||
}
|
||||
@ -119,18 +121,18 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr, const std::string& team_
|
||||
void MasterSvrMgr::RemoveRequest(int socket_handle, long long context_id, bool auto_free)
|
||||
{
|
||||
if (context_id == GetContextIdBySocket(socket_handle)) {
|
||||
if (auto_free) {
|
||||
f8::MsgHdr* hdr = GetHdrByContextId(context_id);
|
||||
if (hdr) {
|
||||
a8::TimerAttacher* timer_attacher = (a8::TimerAttacher*)hdr->user_data;
|
||||
delete timer_attacher;
|
||||
if (auto_free) {
|
||||
if (hdr->buf) {
|
||||
free((char*)hdr->buf);
|
||||
}
|
||||
free(hdr);
|
||||
}
|
||||
pending_request_hash_.erase(context_id);
|
||||
}
|
||||
pending_request_hash_.erase(context_id);
|
||||
pending_socket_hash_.erase(socket_handle);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user