fix invalid read
This commit is contained in:
parent
65a1dcc30e
commit
8e58f2387b
|
@ -714,7 +714,7 @@ static void addConnToPool(void* pool, SCliConn* conn) {
|
||||||
cliDestroyConnMsgs(conn, false);
|
cliDestroyConnMsgs(conn, false);
|
||||||
|
|
||||||
if (conn->list == NULL) {
|
if (conn->list == NULL) {
|
||||||
conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr) + 1);
|
conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
SConnList* pList = conn->list;
|
SConnList* pList = conn->list;
|
||||||
|
@ -1279,7 +1279,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) {
|
||||||
|
|
||||||
if (pMsg != NULL && REQUEST_NO_RESP(&pMsg->msg) &&
|
if (pMsg != NULL && REQUEST_NO_RESP(&pMsg->msg) &&
|
||||||
(pTransInst->failFastFp != NULL && pTransInst->failFastFp(pMsg->msg.msgType))) {
|
(pTransInst->failFastFp != NULL && pTransInst->failFastFp(pMsg->msg.msgType))) {
|
||||||
SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr) + 1);
|
SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr));
|
||||||
int64_t cTimestamp = taosGetTimestampMs();
|
int64_t cTimestamp = taosGetTimestampMs();
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
int32_t elapse = cTimestamp - item->timestamp;
|
int32_t elapse = cTimestamp - item->timestamp;
|
||||||
|
@ -1291,7 +1291,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SFailFastItem item = {.count = 1, .timestamp = cTimestamp};
|
SFailFastItem item = {.count = 1, .timestamp = cTimestamp};
|
||||||
taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr) + 1, &item, sizeof(SFailFastItem));
|
taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1471,7 +1471,7 @@ FORCE_INLINE int32_t cliBuildExceptResp(SCliMsg* pMsg, STransMsg* pResp) {
|
||||||
}
|
}
|
||||||
static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) {
|
static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn) {
|
||||||
uint32_t addr = 0;
|
uint32_t addr = 0;
|
||||||
uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn) + 1);
|
uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn));
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
addr = taosGetIpv4FromFqdn(fqdn);
|
addr = taosGetIpv4FromFqdn(fqdn);
|
||||||
if (addr == 0xffffffff) {
|
if (addr == 0xffffffff) {
|
||||||
|
@ -1480,7 +1480,7 @@ static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn)
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashPut(cache, fqdn, strlen(fqdn) + 1, &addr, sizeof(addr));
|
taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr));
|
||||||
} else {
|
} else {
|
||||||
addr = *v;
|
addr = *v;
|
||||||
}
|
}
|
||||||
|
@ -1490,13 +1490,13 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn) {
|
||||||
// impl later
|
// impl later
|
||||||
uint32_t addr = taosGetIpv4FromFqdn(fqdn);
|
uint32_t addr = taosGetIpv4FromFqdn(fqdn);
|
||||||
if (addr != 0xffffffff) {
|
if (addr != 0xffffffff) {
|
||||||
uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn) + 1);
|
uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn));
|
||||||
if (addr != *v) {
|
if (addr != *v) {
|
||||||
char old[64] = {0}, new[64] = {0};
|
char old[64] = {0}, new[64] = {0};
|
||||||
tinet_ntoa(old, *v);
|
tinet_ntoa(old, *v);
|
||||||
tinet_ntoa(new, addr);
|
tinet_ntoa(new, addr);
|
||||||
tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new);
|
tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new);
|
||||||
taosHashPut(cache, fqdn, strlen(fqdn) + 1, &addr, sizeof(addr));
|
taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue