fix heartbeat problem

This commit is contained in:
yihaoDeng 2022-04-24 17:54:01 +08:00
parent 80ae360e8b
commit 4cf04e264e
1 changed files with 9 additions and 3 deletions

View File

@ -20,6 +20,7 @@
static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT;
static char* notify = "a"; static char* notify = "a";
static int transSrvInst = 0;
typedef struct { typedef struct {
int notifyCount; // int notifyCount; //
@ -757,8 +758,6 @@ static void destroyConn(SSrvConn* conn, bool clear) {
if (conn == NULL) { if (conn == NULL) {
return; return;
} }
uvReleaseExHandle(conn->refId);
uvRemoveExHandle(conn->refId);
transDestroyBuffer(&conn->readBuf); transDestroyBuffer(&conn->readBuf);
if (clear) { if (clear) {
@ -774,6 +773,9 @@ static void uvDestroyConn(uv_handle_t* handle) {
} }
SWorkThrdObj* thrd = conn->hostThrd; SWorkThrdObj* thrd = conn->hostThrd;
uvReleaseExHandle(conn->refId);
uvRemoveExHandle(conn->refId);
tDebug("server conn %p destroy", conn); tDebug("server conn %p destroy", conn);
// uv_timer_stop(&conn->pTimer); // uv_timer_stop(&conn->pTimer);
transQueueDestroy(&conn->srvMsgs); transQueueDestroy(&conn->srvMsgs);
@ -799,6 +801,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
uv_loop_init(srv->loop); uv_loop_init(srv->loop);
taosThreadOnce(&transModuleInit, uvInitExHandleMgt); taosThreadOnce(&transModuleInit, uvInitExHandleMgt);
transSrvInst++;
// uvOpenExHandleMgt(10000); // uvOpenExHandleMgt(10000);
for (int i = 0; i < srv->numOfThreads; i++) { for (int i = 0; i < srv->numOfThreads; i++) {
@ -974,7 +977,10 @@ void transCloseServer(void* arg) {
taosMemoryFree(srv); taosMemoryFree(srv);
// uvCloseExHandleMgt(); transSrvInst--;
if (transSrvInst == 0) {
uvCloseExHandleMgt();
}
} }
void transRefSrvHandle(void* handle) { void transRefSrvHandle(void* handle) {