diff --git a/src/plugins/http/src/httpContext.c b/src/plugins/http/src/httpContext.c index ad72ac8823ab42a31a63d45fa20f2616cc763702..e36791169531dc5d1422f74fddd8532d9611c230 100644 --- a/src/plugins/http/src/httpContext.c +++ b/src/plugins/http/src/httpContext.c @@ -31,8 +31,8 @@ static void httpRemoveContextFromEpoll(HttpContext *pContext) { HttpThread *pThread = pContext->pThread; if (pContext->fd >= 0) { epoll_ctl(pThread->pollFd, EPOLL_CTL_DEL, pContext->fd, NULL); - taosCloseSocket(pContext->fd); - pContext->fd = -1; + int32_t fd = atomic_val_compare_exchange_32(&pContext->fd, pContext->fd, -1); + taosCloseSocket(fd); } }