Merge branch '3.0' into enh/opt-transport

This commit is contained in:
yihaoDeng 2024-09-16 17:33:03 +08:00
parent c345383d5a
commit 12b560e6db
1 changed files with 6 additions and 4 deletions

View File

@ -371,18 +371,20 @@ void cliConnMayUpdateTimer(SCliConn* conn, int timeout) {
if (pInst->startReadTimer == 0) { if (pInst->startReadTimer == 0) {
return; return;
} }
// reset previous timer
if (conn->timer != NULL) { if (conn->timer != NULL) {
// reset previous timer // reset previous timer
cliResetConnTimer(conn); cliResetConnTimer(conn);
} }
int32_t reqsSentNum = transQueueSize(&conn->reqsSentOut); int32_t reqsSentNum = transQueueSize(&conn->reqsSentOut);
if (reqsSentNum == 0) { if (reqsSentNum == 0) {
// no need to set timer
return; return;
} }
if (conn->timer == NULL) {
if (cliGetConnTimer(conn->hostThrd, conn) != 0) { // start a new timer
return; if (cliGetConnTimer(conn->hostThrd, conn) != 0) {
} return;
} }
uv_timer_start(conn->timer, cliConnTimeout__checkReq, timeout, 0); uv_timer_start(conn->timer, cliConnTimeout__checkReq, timeout, 0);
} }