TD-1645
This commit is contained in:
parent
a8b8ecb20e
commit
c608fba88e
|
@ -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);
|
if (fd != -1) taosCloseSocket(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +228,6 @@ void taosCleanUpTcpServer(void *handle) {
|
||||||
for (int i = 0; i < pServerObj->numOfThreads; ++i) {
|
for (int i = 0; i < pServerObj->numOfThreads; ++i) {
|
||||||
pThreadObj = pServerObj->pThreadObj[i];
|
pThreadObj = pServerObj->pThreadObj[i];
|
||||||
taosStopTcpThread(pThreadObj);
|
taosStopTcpThread(pThreadObj);
|
||||||
pthread_mutex_destroy(&(pThreadObj->mutex));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tDebug("%s TCP server is cleaned up", pServerObj->label);
|
tDebug("%s TCP server is cleaned up", pServerObj->label);
|
||||||
|
@ -526,6 +528,7 @@ static void *taosProcessTcpData(void *param) {
|
||||||
taosFreeFdObj(pFdObj);
|
taosFreeFdObj(pFdObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_destroy(&(pThreadObj->mutex));
|
||||||
tDebug("%s TCP thread exits ...", pThreadObj->label);
|
tDebug("%s TCP thread exits ...", pThreadObj->label);
|
||||||
taosTFree(pThreadObj);
|
taosTFree(pThreadObj);
|
||||||
|
|
||||||
|
|
|
@ -140,18 +140,15 @@ void taosStopUdpConnection(void *handle) {
|
||||||
pConn = pSet->udpConn + i;
|
pConn = pSet->udpConn + i;
|
||||||
if (pConn->fd >=0) shutdown(pConn->fd, SHUT_RDWR);
|
if (pConn->fd >=0) shutdown(pConn->fd, SHUT_RDWR);
|
||||||
if (pConn->fd >=0) taosCloseSocket(pConn->fd);
|
if (pConn->fd >=0) taosCloseSocket(pConn->fd);
|
||||||
pConn->fd = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pSet->threads; ++i) {
|
for (int i = 0; i < pSet->threads; ++i) {
|
||||||
pConn = pSet->udpConn + i;
|
pConn = pSet->udpConn + i;
|
||||||
if (taosCheckPthreadValid(pConn->thread)) {
|
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);
|
tDebug("%s UDP is stopped", pSet->label);
|
||||||
|
@ -233,9 +230,6 @@ static void *taosRecvUdpData(void *param) {
|
||||||
(*(pConn->processData))(&recvInfo);
|
(*(pConn->processData))(&recvInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosTFree(pConn->buffer);
|
|
||||||
tDebug("%s UDP recv thread exits", pConn->label);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,5 +324,5 @@ static void taosStopPoolThread(SThreadObj *pThread) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_join(thread, NULL);
|
pthread_join(thread, NULL);
|
||||||
taosClose(fd);
|
if (fd >= 0) taosClose(fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue