1
This commit is contained in:
parent
d7ea1075ab
commit
86a709acbf
@ -37,7 +37,25 @@ void DownStream::ForwardUpStreamMsg(f8::MsgHdr& hdr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (auto long_session = long_session_wp_.lock(); !long_session_wp_.expired()) {
|
if (auto long_session = long_session_wp_.lock(); !long_session_wp_.expired()) {
|
||||||
|
if (hdr.msgid == ss::_SS_CMPing) {
|
||||||
|
ss::SS_SMPing msg;
|
||||||
|
msg.set_source(1);
|
||||||
|
{
|
||||||
|
free(buff);
|
||||||
|
|
||||||
|
buff = (char*)malloc(sizeof(f8::PackHead) + msg.ByteSize());
|
||||||
|
f8::PackHead* head = (f8::PackHead*)buff;
|
||||||
|
head->packlen = msg.ByteSize();
|
||||||
|
head->msgid = hdr.msgid;
|
||||||
|
head->seqid = hdr.seqid;
|
||||||
|
head->magic_code = f8::MAGIC_CODE;
|
||||||
|
head->ext_len = hdr.buflen >> 16;
|
||||||
|
msg.SerializeToArray(buff + sizeof(f8::PackHead), head->packlen);
|
||||||
|
}
|
||||||
long_session->GetKcpSession()->SendClientMsg(buff, sizeof(f8::PackHead) + head->packlen);
|
long_session->GetKcpSession()->SendClientMsg(buff, sizeof(f8::PackHead) + head->packlen);
|
||||||
|
} else {
|
||||||
|
long_session->GetKcpSession()->SendClientMsg(buff, sizeof(f8::PackHead) + head->packlen);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GCListener::Instance()->SendBuf(hdr.socket_handle, buff, sizeof(f8::PackHead) + head->packlen);
|
GCListener::Instance()->SendBuf(hdr.socket_handle, buff, sizeof(f8::PackHead) + head->packlen);
|
||||||
}
|
}
|
||||||
@ -57,18 +75,12 @@ void DownStream::OnClose()
|
|||||||
|
|
||||||
void DownStream::ProcCMMsg(f8::MsgHdr& hdr, int tag)
|
void DownStream::ProcCMMsg(f8::MsgHdr& hdr, int tag)
|
||||||
{
|
{
|
||||||
if (hdr.msgid == ss::_SS_CMPing) {
|
if (hdr.msgid == ss::_SS_CMPing && IsLongSession() && tag == ST_Tcp) {
|
||||||
ss::SS_SMPing msg;
|
ss::SS_SMPing msg;
|
||||||
if (IsLongSession() && tag == ST_Tcp) {
|
|
||||||
GCListener::Instance()->SendMsgEx(socket_handle_, ss::_SS_CMPing, msg);
|
GCListener::Instance()->SendMsgEx(socket_handle_, ss::_SS_CMPing, msg);
|
||||||
if (!long_session_wp_.expired()) {
|
if (!long_session_wp_.expired()) {
|
||||||
long_session_wp_.lock()->UpdatePing();
|
long_session_wp_.lock()->UpdatePing();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!long_session_wp_.expired()) {
|
|
||||||
msg.set_source(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!GetUpStream().expired()) {
|
if (!GetUpStream().expired()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user