From 56793dd89b28a6f1b467b58e14f7484ac4800b11 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 10 Sep 2024 10:54:04 +0800 Subject: [PATCH] opt transport --- source/libs/transport/inc/transComm.h | 1 - source/libs/transport/src/transCli.c | 2 +- source/libs/transport/src/transSvr.c | 22 ++++++++++------------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index 451109cd59..7053c428e2 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -183,7 +183,6 @@ typedef struct { int32_t compatibilityVer; uint32_t magicNum; STraceId traceId; - uint64_t ahandle; // ahandle assigned by client int64_t qid; uint32_t code; // del later uint32_t msgType; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 712b278e31..7c09082e5b 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1517,7 +1517,7 @@ void cliSendBatch_shareConn(SCliConn* pConn) { STransMsgHead* pHead = transHeadFromCont(pReq->pCont); if (pHead->comp == 0) { - pHead->ahandle = pCtx != NULL ? (uint64_t)pCtx->ahandle : 0; + // pHead->ahandle = pCtx != NULL ? (uint64_t)pCtx->ahandle : 0; pHead->noResp = REQUEST_NO_RESP(pReq) ? 1 : 0; pHead->persist = REQUEST_PERSIS_HANDLE(pReq) ? 1 : 0; pHead->msgType = pReq->msgType; diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 97afc77b9a..1ce1cb0596 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -484,7 +484,7 @@ static bool uvHandleReq(SSvrConn* pConn) { tError("%s conn %p recv invalid packet, failed to decompress", transLabel(pInst), pConn); return false; } - pHead->ahandle = htole64(pHead->ahandle); + // pHead->ahandle = htole64(pHead->ahandle); pHead->code = htonl(pHead->code); pHead->msgLen = htonl(pHead->msgLen); @@ -763,12 +763,16 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg) { if (pConn->broken) { return; } - queue sendReqNode; - QUEUE_INIT(&sendReqNode); + + SWriteReq* pWreq = taosMemoryCalloc(1, sizeof(SWriteReq)); + pWreq->conn = pConn; + QUEUE_INIT(&pWreq->q); + QUEUE_INIT(&pWreq->node); + pWreq->req.data = pWreq; uv_buf_t* pBuf = NULL; int32_t bufNum = 0; - code = uvBuildToSendData(pConn, &pBuf, &bufNum, &sendReqNode); + code = uvBuildToSendData(pConn, &pBuf, &bufNum, &pWreq->node); if (code != 0) { tError("%s conn %p failed to send data", transLabel(pConn->pInst), pConn); return; @@ -780,12 +784,6 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg) { transRefSrvHandle(pConn); - SWriteReq* pWreq = taosMemoryCalloc(1, sizeof(SWriteReq)); - pWreq->conn = pConn; - QUEUE_INIT(&pWreq->q); - QUEUE_MOVE(&sendReqNode, &pWreq->node); - pWreq->req.data = pWreq; - uv_write_t* req = &pWreq->req; if (req == NULL) { if (!uv_is_closing((uv_handle_t*)(pConn->pTcp))) { @@ -1711,7 +1709,7 @@ void transRefSrvHandle(void* handle) { } SSvrConn* pConn = handle; pConn->ref++; - tTrace("conn %p ref count:%d", handle, pConn->ref); + tTrace("conn %p ref count:%d", pConn, pConn->ref); } void transUnrefSrvHandle(void* handle) { @@ -1720,7 +1718,7 @@ void transUnrefSrvHandle(void* handle) { } SSvrConn* pConn = handle; pConn->ref--; - tTrace("conn %p ref count:%d", handle, pConn->ref); + tTrace("conn %p ref count:%d", pConn, pConn->ref); if (pConn->ref == 0) { destroyConn((SSvrConn*)handle, true); }