提交 e5614964 编写于 作者: D dapan1121

Merge branch 'feature/scheduler' of github.com:taosdata/TDengine into feature/scheduler

...@@ -159,7 +159,7 @@ static void destroyThrdObj(SCliThrdObj* pThrd); ...@@ -159,7 +159,7 @@ static void destroyThrdObj(SCliThrdObj* pThrd);
int i = 0, sz = transQueueSize(&conn->cliMsgs); \ int i = 0, sz = transQueueSize(&conn->cliMsgs); \
for (; i < sz; i++) { \ for (; i < sz; i++) { \
pMsg = transQueueGet(&conn->cliMsgs, i); \ pMsg = transQueueGet(&conn->cliMsgs, i); \
if (pMsg != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \ if (pMsg != NULL && pMsg->ctx != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \
break; \ break; \
} \ } \
} \ } \
......
...@@ -644,6 +644,7 @@ static void uvDestroyConn(uv_handle_t* handle) { ...@@ -644,6 +644,7 @@ static void uvDestroyConn(uv_handle_t* handle) {
// free(conn); // free(conn);
if (thrd->quit && QUEUE_IS_EMPTY(&thrd->conn)) { if (thrd->quit && QUEUE_IS_EMPTY(&thrd->conn)) {
tTrace("work thread quit");
uv_loop_close(thrd->loop); uv_loop_close(thrd->loop);
uv_stop(thrd->loop); uv_stop(thrd->loop);
} }
...@@ -705,12 +706,12 @@ End: ...@@ -705,12 +706,12 @@ End:
return NULL; return NULL;
} }
void uvHandleQuit(SSrvMsg* msg, SWorkThrdObj* thrd) { void uvHandleQuit(SSrvMsg* msg, SWorkThrdObj* thrd) {
thrd->quit = true;
if (QUEUE_IS_EMPTY(&thrd->conn)) { if (QUEUE_IS_EMPTY(&thrd->conn)) {
uv_loop_close(thrd->loop); uv_loop_close(thrd->loop);
uv_stop(thrd->loop); uv_stop(thrd->loop);
} else { } else {
destroyAllConn(thrd); destroyAllConn(thrd);
thrd->quit = true;
} }
free(msg); free(msg);
} }
...@@ -773,15 +774,16 @@ void sendQuitToWorkThrd(SWorkThrdObj* pThrd) { ...@@ -773,15 +774,16 @@ void sendQuitToWorkThrd(SWorkThrdObj* pThrd) {
void transCloseServer(void* arg) { void transCloseServer(void* arg) {
// impl later // impl later
SServerObj* srv = arg; SServerObj* srv = arg;
for (int i = 0; i < srv->numOfThreads; i++) {
sendQuitToWorkThrd(srv->pThreadObj[i]);
destroyWorkThrd(srv->pThreadObj[i]);
}
tDebug("send quit msg to accept thread"); tDebug("send quit msg to accept thread");
uv_async_send(srv->pAcceptAsync); uv_async_send(srv->pAcceptAsync);
taosThreadJoin(srv->thread, NULL); taosThreadJoin(srv->thread, NULL);
for (int i = 0; i < srv->numOfThreads; i++) {
sendQuitToWorkThrd(srv->pThreadObj[i]);
destroyWorkThrd(srv->pThreadObj[i]);
}
free(srv->pThreadObj); free(srv->pThreadObj);
free(srv->pAcceptAsync); free(srv->pAcceptAsync);
free(srv->loop); free(srv->loop);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册