fix invalid packet
This commit is contained in:
parent
bb052b81dd
commit
44eaa27989
|
@ -794,6 +794,7 @@ void cliSend(SCliConn* pConn) {
|
|||
int msgLen = transMsgLenFromCont(pMsg->contLen);
|
||||
STransMsgHead* pHead = transHeadFromCont(pMsg->pCont);
|
||||
|
||||
if (pHead->comp == 0) {
|
||||
pHead->ahandle = pCtx != NULL ? (uint64_t)pCtx->ahandle : 0;
|
||||
pHead->noResp = REQUEST_NO_RESP(pMsg) ? 1 : 0;
|
||||
pHead->persist = REQUEST_PERSIS_HANDLE(pMsg) ? 1 : 0;
|
||||
|
@ -803,6 +804,8 @@ void cliSend(SCliConn* pConn) {
|
|||
memcpy(pHead->user, pTransInst->user, strlen(pTransInst->user));
|
||||
pHead->traceId = pMsg->info.traceId;
|
||||
pHead->magicNum = htonl(TRANS_MAGIC_NUM);
|
||||
}
|
||||
|
||||
if (pHead->persist == 1) {
|
||||
CONN_SET_PERSIST_BY_APP(pConn);
|
||||
}
|
||||
|
|
|
@ -61,12 +61,12 @@ int32_t transDecompressMsg(char** msg, int32_t len) {
|
|||
if (pHead->comp == 0) return 0;
|
||||
|
||||
char* pCont = transContFromHead(pHead);
|
||||
|
||||
STransCompMsg* pComp = (STransCompMsg*)pCont;
|
||||
int32_t oriLen = htonl(pComp->contLen);
|
||||
|
||||
char* buf = taosMemoryCalloc(1, oriLen + sizeof(STransMsgHead));
|
||||
STransMsgHead* pNewHead = (STransMsgHead*)buf;
|
||||
|
||||
int32_t decompLen = LZ4_decompress_safe(pCont + sizeof(STransCompMsg), pNewHead->content,
|
||||
len - sizeof(STransMsgHead) - sizeof(STransCompMsg), oriLen);
|
||||
memcpy((char*)pNewHead, (char*)pHead, sizeof(STransMsgHead));
|
||||
|
@ -74,7 +74,6 @@ int32_t transDecompressMsg(char** msg, int32_t len) {
|
|||
pNewHead->msgLen = htonl(oriLen + sizeof(STransMsgHead));
|
||||
|
||||
taosMemoryFree(pHead);
|
||||
|
||||
*msg = buf;
|
||||
if (decompLen != oriLen) {
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue