This commit is contained in:
aozhiwei 2018-08-07 20:43:03 +08:00
parent 2555f9a628
commit d69565b450
3 changed files with 13 additions and 3 deletions

View File

@ -105,8 +105,11 @@ void GCListener::ForwardTargetConnMsg(MsgHdr& hdr)
#if 1
head->rpc_error_code = hdr.ip_saddr;
#endif
if (hdr.buflen > 0) {
memmove(buff + sizeof(PackHead), hdr.buf, hdr.buflen);
}
tcp_listener_->SendClientMsg(hdr.socket_handle, buff, sizeof(PackHead*) + head->packlen);
tcp_listener_->SendClientMsg(hdr.socket_handle, buff, sizeof(PackHead) + head->packlen);
free(buff);
}

View File

@ -281,6 +281,7 @@ void App::DispatchMsg()
MsgNode *pdelnode = work_node_;
work_node_ = pdelnode->next;
hdr.msgid = pdelnode->msgid;
hdr.seqid = pdelnode->seqid;
hdr.socket_handle = pdelnode->sockhandle;
hdr.buf = pdelnode->buf;
hdr.buflen = pdelnode->buflen;
@ -347,8 +348,10 @@ void App::ProcessTargetServerMsg(MsgHdr& hdr)
return;
}
if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReConnect) {
#if 0
GameClientMgr::Instance()->BindTargetConn(hdr.socket_handle, hdr.ip_saddr);
GCListener::Instance()->MarkClient(hdr.socket_handle, true);
#endif
}
GCListener::Instance()->ForwardTargetConnMsg(hdr);
}

View File

@ -78,7 +78,11 @@ void TargetConn::ForwardClientMsg(MsgHdr& hdr)
head->socket_handle = hdr.socket_handle;
head->ip_saddr = hdr.ip_saddr;
tcp_client_->SendBuff(buff, sizeof(WSProxyPackHead_C*) + head->packlen);
if (hdr.buflen > 0) {
memmove(buff + sizeof(WSProxyPackHead_C), hdr.buf, hdr.buflen);
}
tcp_client_->SendBuff(buff, sizeof(WSProxyPackHead_C) + head->packlen);
free(buff);
}
@ -119,7 +123,7 @@ void TargetConn::on_socketread(a8::TcpClient* sender, char* buf, unsigned int le
bool warning = false;
unsigned int offset = 0;
while (recv_bufflen_ - offset > sizeof(WSProxyPackHead_S)) {
while (recv_bufflen_ - offset >= sizeof(WSProxyPackHead_S)) {
WSProxyPackHead_S* p = (WSProxyPackHead_S*) &recv_buff_[offset];
if (p->magic_code == MAGIC_CODE) {
if (recv_bufflen_ - offset < sizeof(PackHead) + p->packlen) {