diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 674d560952a246d517832f184a8b63625af9964c..5d156492c7dbd5641ba24bbf0835ccafa26a15a5 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -437,7 +437,7 @@ static void *taosProcessTcpData(void *param) { while (1) { int fdNum = epoll_wait(pThreadObj->pollFd, events, maxEvents, -1); if (pThreadObj->stop) { - tTrace("%s, tcp thread get stop event, exiting...", pThreadObj->label); + tTrace("%s TCP thread get stop event, exiting...", pThreadObj->label); break; } if (fdNum < 0) continue; diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index 279cf7ed49be70d31b3afc86d53b07453578806f..41446f87fbd13a5c610f381f6fe9b1eee679b13e 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -142,16 +142,15 @@ void taosCleanUpUdpConnection(void *handle) { pConn = pSet->udpConn + i; pConn->signature = NULL; - // shutdown to signal the thread to exit - if ( pConn->fd >=0) shutdown(pConn->fd, SHUT_RD); + if (pConn->fd >=0) shutdown(pConn->fd, SHUT_RDWR); + if (pConn->fd >=0) taosCloseSocket(pConn->fd); } for (int i = 0; i < pSet->threads; ++i) { pConn = pSet->udpConn + i; if (pConn->thread) pthread_join(pConn->thread, NULL); - if (pConn->fd >=0) taosCloseSocket(pConn->fd); tfree(pConn->buffer); - tTrace("UDP chandle:%p is closed", pConn); + tTrace("%s UDP thread is closed, inedx:%d", pConn->label, i); } tfree(pSet); @@ -185,15 +184,15 @@ static void *taosRecvUdpData(void *param) { while (1) { dataLen = recvfrom(pConn->fd, pConn->buffer, RPC_MAX_UDP_SIZE, 0, (struct sockaddr *)&sourceAdd, &addLen); - if(dataLen == 0) { - tTrace("data length is 0, socket was closed, exiting"); + if(dataLen <= 0) { + tTrace("%s UDP socket was closed, exiting", pConn->label); break; } port = ntohs(sourceAdd.sin_port); if (dataLen < sizeof(SRpcHead)) { - tError("%s recvfrom failed, reason:%s\n", pConn->label, strerror(errno)); + tError("%s recvfrom failed(%s)", pConn->label, strerror(errno)); continue; }