fix hb issue
This commit is contained in:
parent
4d314b569a
commit
dfd077a4c9
|
@ -227,7 +227,7 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp);
|
|||
|
||||
// cluster level
|
||||
SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char *key);
|
||||
void appHbMgrCleanup(SAppHbMgr* pAppHbMgr);
|
||||
void appHbMgrCleanup(void);
|
||||
|
||||
// conn level
|
||||
int hbRegisterConn(SAppHbMgr* pAppHbMgr, int32_t connId, int64_t clusterId, int32_t hbType);
|
||||
|
|
|
@ -430,22 +430,16 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char *key) {
|
|||
return pAppHbMgr;
|
||||
}
|
||||
|
||||
void appHbMgrCleanup(SAppHbMgr* pAppHbMgr) {
|
||||
if (NULL == pAppHbMgr) {
|
||||
return;
|
||||
}
|
||||
|
||||
void appHbMgrCleanup(void) {
|
||||
pthread_mutex_lock(&clientHbMgr.lock);
|
||||
|
||||
int sz = taosArrayGetSize(clientHbMgr.appHbMgrs);
|
||||
for (int i = 0; i < sz; i++) {
|
||||
SAppHbMgr* pTarget = taosArrayGetP(clientHbMgr.appHbMgrs, i);
|
||||
if (pAppHbMgr == pTarget) {
|
||||
taosHashCleanup(pTarget->activeInfo);
|
||||
pTarget->activeInfo = NULL;
|
||||
taosHashCleanup(pTarget->connInfo);
|
||||
pTarget->connInfo = NULL;
|
||||
}
|
||||
taosHashCleanup(pTarget->activeInfo);
|
||||
pTarget->activeInfo = NULL;
|
||||
taosHashCleanup(pTarget->connInfo);
|
||||
pTarget->connInfo = NULL;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&clientHbMgr.lock);
|
||||
|
@ -476,6 +470,7 @@ void hbMgrCleanUp() {
|
|||
if (old == 0) return;
|
||||
|
||||
pthread_mutex_lock(&clientHbMgr.lock);
|
||||
appHbMgrCleanup();
|
||||
taosArrayDestroy(clientHbMgr.appHbMgrs);
|
||||
pthread_mutex_unlock(&clientHbMgr.lock);
|
||||
|
||||
|
@ -535,9 +530,6 @@ void hbDeregisterConn(SAppHbMgr* pAppHbMgr, SClientHbKey connKey) {
|
|||
return;
|
||||
}
|
||||
atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
|
||||
if (atomic_load_32(&pAppHbMgr->connKeyCnt) <= 0) {
|
||||
appHbMgrCleanup(pAppHbMgr);
|
||||
}
|
||||
}
|
||||
|
||||
int hbAddConnInfo(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, void* key, void* value, int32_t keyLen, int32_t valueLen) {
|
||||
|
|
Loading…
Reference in New Issue