添加ext_len处理

This commit is contained in:
aozhiwei 2019-06-01 16:36:22 +08:00
parent 72b2b79e58
commit 1804cbea7d
3 changed files with 7 additions and 6 deletions

View File

@ -133,7 +133,7 @@ void GCListener::ForwardTargetConnMsg(f8::MsgHdr& hdr)
head->msgid = hdr.msgid;
head->seqid = hdr.seqid;
head->magic_code = f8::MAGIC_CODE;
head->rpc_error_code = 0;
head->ext_len = hdr.buflen >> 16;
if (hdr.buflen > 0) {
memmove(buff + sizeof(f8::PackHead), hdr.buf, hdr.buflen);
}

View File

@ -10,7 +10,7 @@
#include <a8/timer.h>
#include "app.h"
const int PACK_MAX = 1024 * 64;
const int PACK_MAX = 1024 * 64 * 2;
void TargetConn::Init(int instance_id, const std::string& remote_ip, int remote_port)
{
@ -157,8 +157,9 @@ void TargetConn::on_socketread(a8::TcpClient* sender, char* buf, unsigned int le
unsigned int offset = 0;
while (recv_bufflen_ - offset >= sizeof(f8::WSProxyPackHead_S)) {
f8::WSProxyPackHead_S* p = (f8::WSProxyPackHead_S*) &recv_buff_[offset];
int real_len = p->packlen + (p->ext_len << 16);
if (p->magic_code == f8::MAGIC_CODE) {
if (recv_bufflen_ - offset < sizeof(f8::WSProxyPackHead_S) + p->packlen) {
if (recv_bufflen_ - offset < sizeof(f8::WSProxyPackHead_S) + real_len) {
break;
}
App::Instance()->AddSocketMsg(SF_TargetServer,
@ -167,8 +168,8 @@ void TargetConn::on_socketread(a8::TcpClient* sender, char* buf, unsigned int le
p->msgid,
p->seqid,
&recv_buff_[offset + sizeof(f8::WSProxyPackHead_S)],
p->packlen);
offset += sizeof(f8::WSProxyPackHead_S) + p->packlen;
real_len);
offset += sizeof(f8::WSProxyPackHead_S) + real_len;
} else {
warning = true;
offset++;

@ -1 +1 @@
Subproject commit 7af5d3b84aeaa84a2979c24db9db5ed5a43cea2d
Subproject commit 366eeab6832866357dec147004b99a0c95e7ad8f