fix invalid packet

This commit is contained in:
yihaoDeng 2022-08-17 23:02:22 +08:00
parent c6f60ba3d7
commit 66f6dcddb8
1 changed files with 4 additions and 3 deletions

View File

@ -276,6 +276,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
while (transReadComplete(pBuf)) { while (transReadComplete(pBuf)) {
tTrace("%s conn %p alread read complete packet", transLabel(pTransInst), conn); tTrace("%s conn %p alread read complete packet", transLabel(pTransInst), conn);
if (pBuf->invalid) { if (pBuf->invalid) {
tTrace("%s conn %p alread read invalid packet", transLabel(pTransInst), conn);
destroyConn(conn, true); destroyConn(conn, true);
break; break;
} else { } else {
@ -600,7 +601,7 @@ static bool uvRecvReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) {
(*pTransInst->cfp)(pTransInst->parent, &(pConn->regArg.msg), NULL); (*pTransInst->cfp)(pTransInst->parent, &(pConn->regArg.msg), NULL);
memset(&pConn->regArg, 0, sizeof(pConn->regArg)); memset(&pConn->regArg, 0, sizeof(pConn->regArg));
} }
uvStartSendResp(srvMsg); uvStartSendRespInternal(srvMsg);
return true; return true;
} }
return false; return false;
@ -872,6 +873,7 @@ static int reallocConnRef(SSvrConn* conn) {
} }
static void uvDestroyConn(uv_handle_t* handle) { static void uvDestroyConn(uv_handle_t* handle) {
SSvrConn* conn = handle->data; SSvrConn* conn = handle->data;
if (conn == NULL) { if (conn == NULL) {
return; return;
} }
@ -887,9 +889,8 @@ static void uvDestroyConn(uv_handle_t* handle) {
SSvrMsg* msg = transQueueGet(&conn->srvMsgs, i); SSvrMsg* msg = transQueueGet(&conn->srvMsgs, i);
destroySmsg(msg); destroySmsg(msg);
} }
transReqQueueClear(&conn->wreqQueue);
transQueueDestroy(&conn->srvMsgs); transQueueDestroy(&conn->srvMsgs);
transReqQueueClear(&conn->wreqQueue);
QUEUE_REMOVE(&conn->queue); QUEUE_REMOVE(&conn->queue);
taosMemoryFree(conn->pTcp); taosMemoryFree(conn->pTcp);