fix: fix invalid read-write
This commit is contained in:
parent
16bc8cb5df
commit
f570ac22cf
|
@ -727,7 +727,7 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) {
|
||||||
QUEUE_INIT(&conn->q);
|
QUEUE_INIT(&conn->q);
|
||||||
conn->hostThrd = pThrd;
|
conn->hostThrd = pThrd;
|
||||||
conn->status = ConnNormal;
|
conn->status = ConnNormal;
|
||||||
conn->broken = 0;
|
conn->broken = false;
|
||||||
transRefCliHandle(conn);
|
transRefCliHandle(conn);
|
||||||
|
|
||||||
atomic_add_fetch_32(&pThrd->connCount, 1);
|
atomic_add_fetch_32(&pThrd->connCount, 1);
|
||||||
|
@ -997,6 +997,11 @@ static void cliDestroyBatch(SCliBatch* pBatch) {
|
||||||
taosMemoryFree(pBatch);
|
taosMemoryFree(pBatch);
|
||||||
}
|
}
|
||||||
static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
|
static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
|
||||||
|
if (pThrd->quit == true) {
|
||||||
|
cliDestroyBatch(pBatch);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pBatch == NULL || pBatch->wLen == 0 || QUEUE_IS_EMPTY(&pBatch->wq)) {
|
if (pBatch == NULL || pBatch->wLen == 0 || QUEUE_IS_EMPTY(&pBatch->wq)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1087,13 +1092,16 @@ static void cliSendBatchCb(uv_write_t* req, int status) {
|
||||||
} else {
|
} else {
|
||||||
tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen,
|
tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen,
|
||||||
p->batchSize);
|
p->batchSize);
|
||||||
|
if (conn->broken != true) {
|
||||||
if (nxtBatch != NULL) {
|
if (nxtBatch != NULL) {
|
||||||
conn->pBatch = nxtBatch;
|
conn->pBatch = nxtBatch;
|
||||||
cliSendBatch(conn);
|
cliSendBatch(conn);
|
||||||
} else {
|
} else {
|
||||||
addConnToPool(thrd->pool, conn);
|
addConnToPool(thrd->pool, conn);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// release by other callback
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cliDestroyBatch(p);
|
cliDestroyBatch(p);
|
||||||
|
|
Loading…
Reference in New Issue