commit
5462326f6e
|
@ -227,7 +227,7 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp);
|
||||||
|
|
||||||
// cluster level
|
// cluster level
|
||||||
SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char *key);
|
SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char *key);
|
||||||
void appHbMgrCleanup(SAppHbMgr* pAppHbMgr);
|
void appHbMgrCleanup(void);
|
||||||
|
|
||||||
// conn level
|
// conn level
|
||||||
int hbRegisterConn(SAppHbMgr* pAppHbMgr, int32_t connId, int64_t clusterId, int32_t hbType);
|
int hbRegisterConn(SAppHbMgr* pAppHbMgr, int32_t connId, int64_t clusterId, int32_t hbType);
|
||||||
|
|
|
@ -431,22 +431,16 @@ SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char *key) {
|
||||||
return pAppHbMgr;
|
return pAppHbMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appHbMgrCleanup(SAppHbMgr* pAppHbMgr) {
|
void appHbMgrCleanup(void) {
|
||||||
if (NULL == pAppHbMgr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_mutex_lock(&clientHbMgr.lock);
|
pthread_mutex_lock(&clientHbMgr.lock);
|
||||||
|
|
||||||
int sz = taosArrayGetSize(clientHbMgr.appHbMgrs);
|
int sz = taosArrayGetSize(clientHbMgr.appHbMgrs);
|
||||||
for (int i = 0; i < sz; i++) {
|
for (int i = 0; i < sz; i++) {
|
||||||
SAppHbMgr* pTarget = taosArrayGetP(clientHbMgr.appHbMgrs, i);
|
SAppHbMgr* pTarget = taosArrayGetP(clientHbMgr.appHbMgrs, i);
|
||||||
if (pAppHbMgr == pTarget) {
|
taosHashCleanup(pTarget->activeInfo);
|
||||||
taosHashCleanup(pTarget->activeInfo);
|
pTarget->activeInfo = NULL;
|
||||||
pTarget->activeInfo = NULL;
|
taosHashCleanup(pTarget->connInfo);
|
||||||
taosHashCleanup(pTarget->connInfo);
|
pTarget->connInfo = NULL;
|
||||||
pTarget->connInfo = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&clientHbMgr.lock);
|
pthread_mutex_unlock(&clientHbMgr.lock);
|
||||||
|
@ -479,6 +473,7 @@ void hbMgrCleanUp() {
|
||||||
if (old == 0) return;
|
if (old == 0) return;
|
||||||
|
|
||||||
pthread_mutex_lock(&clientHbMgr.lock);
|
pthread_mutex_lock(&clientHbMgr.lock);
|
||||||
|
appHbMgrCleanup();
|
||||||
taosArrayDestroy(clientHbMgr.appHbMgrs);
|
taosArrayDestroy(clientHbMgr.appHbMgrs);
|
||||||
pthread_mutex_unlock(&clientHbMgr.lock);
|
pthread_mutex_unlock(&clientHbMgr.lock);
|
||||||
|
|
||||||
|
@ -539,9 +534,6 @@ void hbDeregisterConn(SAppHbMgr* pAppHbMgr, SClientHbKey connKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
|
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) {
|
int hbAddConnInfo(SAppHbMgr *pAppHbMgr, SClientHbKey connKey, void* key, void* value, int32_t keyLen, int32_t valueLen) {
|
||||||
|
|
Loading…
Reference in New Issue