refactor errno code
This commit is contained in:
parent
3eaae2ab75
commit
99fb80cd27
|
@ -1973,11 +1973,11 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
|
||||||
SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, klen);
|
SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, klen);
|
||||||
if (ppBatchList == NULL || *ppBatchList == NULL) {
|
if (ppBatchList == NULL || *ppBatchList == NULL) {
|
||||||
SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList));
|
SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList));
|
||||||
if (pBatchList == NULL) {
|
// if (pBatchList == NULL) {
|
||||||
tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
// tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||||
destroyCmsg(pMsg);
|
// destroyCmsg(pMsg);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
QUEUE_INIT(&pBatchList->wq);
|
QUEUE_INIT(&pBatchList->wq);
|
||||||
pBatchList->port = port;
|
pBatchList->port = port;
|
||||||
pBatchList->connMax = pInst->connLimitNum;
|
pBatchList->connMax = pInst->connLimitNum;
|
||||||
|
@ -1987,21 +1987,21 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
|
||||||
|
|
||||||
pBatchList->ip = taosStrdup(ip);
|
pBatchList->ip = taosStrdup(ip);
|
||||||
pBatchList->dst = taosStrdup(key);
|
pBatchList->dst = taosStrdup(key);
|
||||||
if (pBatchList->ip == NULL || pBatchList->dst == NULL) {
|
// if (pBatchList->ip == NULL || pBatchList->dst == NULL) {
|
||||||
taosMemoryFree(pBatchList->ip);
|
// taosMemoryFree(pBatchList->ip);
|
||||||
taosMemoryFree(pBatchList->dst);
|
// taosMemoryFree(pBatchList->dst);
|
||||||
taosMemoryFree(pBatchList);
|
// taosMemoryFree(pBatchList);
|
||||||
destroyCmsg(pMsg);
|
// destroyCmsg(pMsg);
|
||||||
tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
// tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
||||||
if (pBatch == NULL) {
|
// if (pBatch == NULL) {
|
||||||
tError("failed to create batch, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
// tError("failed to create batch, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||||
destroyCmsg(pMsg);
|
// destroyCmsg(pMsg);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
pBatch->batchSize += pMsg->msg.contLen;
|
pBatch->batchSize += pMsg->msg.contLen;
|
||||||
pBatch->pList = pBatchList;
|
pBatch->pList = pBatchList;
|
||||||
|
@ -2010,21 +2010,21 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
|
||||||
|
|
||||||
code = taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*));
|
code = taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*));
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
taosMemoryFree(pBatch);
|
// taosMemoryFree(pBatch);
|
||||||
taosMemoryFree(pBatchList->ip);
|
// taosMemoryFree(pBatchList->ip);
|
||||||
taosMemoryFree(pBatchList->dst);
|
// taosMemoryFree(pBatchList->dst);
|
||||||
taosMemoryFree(pBatchList);
|
// taosMemoryFree(pBatchList);
|
||||||
tError("failed to put batch list to cache, reason:%s", tstrerror(code));
|
// tError("failed to put batch list to cache, reason:%s", tstrerror(code));
|
||||||
destroyCmsg(pMsg);
|
// destroyCmsg(pMsg);
|
||||||
continue;
|
// continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) {
|
if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) {
|
||||||
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
||||||
if (pBatch == NULL) {
|
// if (pBatch == NULL) {
|
||||||
destroyCmsg(pMsg);
|
// destroyCmsg(pMsg);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
QUEUE_INIT(&pBatch->wq);
|
QUEUE_INIT(&pBatch->wq);
|
||||||
QUEUE_INIT(&pBatch->listq);
|
QUEUE_INIT(&pBatch->listq);
|
||||||
|
|
||||||
|
@ -2044,10 +2044,10 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
|
||||||
pBatch->wLen += 1;
|
pBatch->wLen += 1;
|
||||||
} else {
|
} else {
|
||||||
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
|
||||||
if (pBatch == NULL) {
|
// if (pBatch == NULL) {
|
||||||
destroyCmsg(pMsg);
|
// destroyCmsg(pMsg);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
QUEUE_INIT(&pBatch->wq);
|
QUEUE_INIT(&pBatch->wq);
|
||||||
QUEUE_INIT(&pBatch->listq);
|
QUEUE_INIT(&pBatch->listq);
|
||||||
|
|
Loading…
Reference in New Issue