提交 c608fba8 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

TD-1645

上级 a8b8ecb2
......@@ -196,7 +196,10 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
}
}
if (taosCheckPthreadValid(pThreadObj->thread) && pThreadObj->pollFd >= 0) pthread_join(pThreadObj->thread, NULL);
if (taosCheckPthreadValid(pThreadObj->thread) && pThreadObj->pollFd >= 0) {
pthread_join(pThreadObj->thread, NULL);
}
if (fd != -1) taosCloseSocket(fd);
}
......@@ -225,7 +228,6 @@ void taosCleanUpTcpServer(void *handle) {
for (int i = 0; i < pServerObj->numOfThreads; ++i) {
pThreadObj = pServerObj->pThreadObj[i];
taosStopTcpThread(pThreadObj);
pthread_mutex_destroy(&(pThreadObj->mutex));
}
tDebug("%s TCP server is cleaned up", pServerObj->label);
......@@ -526,6 +528,7 @@ static void *taosProcessTcpData(void *param) {
taosFreeFdObj(pFdObj);
}
pthread_mutex_destroy(&(pThreadObj->mutex));
tDebug("%s TCP thread exits ...", pThreadObj->label);
taosTFree(pThreadObj);
......
......@@ -140,18 +140,15 @@ void taosStopUdpConnection(void *handle) {
pConn = pSet->udpConn + i;
if (pConn->fd >=0) shutdown(pConn->fd, SHUT_RDWR);
if (pConn->fd >=0) taosCloseSocket(pConn->fd);
pConn->fd = -1;
}
for (int i = 0; i < pSet->threads; ++i) {
pConn = pSet->udpConn + i;
if (taosCheckPthreadValid(pConn->thread)) {
if (taosComparePthread(pConn->thread, pthread_self())) {
pthread_detach(pthread_self());
} else {
pthread_join(pConn->thread, NULL);
}
pthread_join(pConn->thread, NULL);
}
taosTFree(pConn->buffer);
// tTrace("%s UDP thread is closed, index:%d", pConn->label, i);
}
tDebug("%s UDP is stopped", pSet->label);
......@@ -233,9 +230,6 @@ static void *taosRecvUdpData(void *param) {
(*(pConn->processData))(&recvInfo);
}
taosTFree(pConn->buffer);
tDebug("%s UDP recv thread exits", pConn->label);
return NULL;
}
......
......@@ -324,5 +324,5 @@ static void taosStopPoolThread(SThreadObj *pThread) {
}
pthread_join(thread, NULL);
taosClose(fd);
if (fd >= 0) taosClose(fd);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册