This commit is contained in:
Jeff Tao 2020-10-01 14:55:00 +00:00
parent 30284cbe59
commit f949b732f5
1 changed files with 8 additions and 1 deletions

View File

@ -205,7 +205,14 @@ void taosStopTcpServer(void *handle) {
if (pServerObj == NULL) return; if (pServerObj == NULL) return;
if(pServerObj->fd >=0) shutdown(pServerObj->fd, SHUT_RD); if(pServerObj->fd >=0) shutdown(pServerObj->fd, SHUT_RD);
if (taosCheckPthreadValid(pServerObj->thread)) pthread_join(pServerObj->thread, NULL);
if (taosCheckPthreadValid(pServerObj->thread)) {
if (pServerObj->thread == pthread_self()) {
pthread_detach(pthread_self());
} else {
pthread_join(pServerObj->thread, NULL);
}
}
tDebug("%s TCP server is stopped", pServerObj->label); tDebug("%s TCP server is stopped", pServerObj->label);
} }