From 1481c8d7ea8e14f76d9b2ec55c932af28c2fe6b0 Mon Sep 17 00:00:00 2001 From: slguan Date: Thu, 15 Aug 2019 13:17:52 +0800 Subject: [PATCH] fix issue #359 --- src/modules/http/src/httpServer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/http/src/httpServer.c b/src/modules/http/src/httpServer.c index 4c20297f77..16c4b968fd 100644 --- a/src/modules/http/src/httpServer.c +++ b/src/modules/http/src/httpServer.c @@ -183,6 +183,10 @@ void httpCloseContextByApp(HttpContext *pContext) { } pthread_mutex_lock(&pContext->mutex); + if (pContext->signature != pContext || pContext->fd <= 0) { + return; + } + pContext->parsed = false; httpTrace("context:%p, fd:%d, ip:%s, app use finished, usedByEpoll:%d, usedByApp:%d, httpVersion:1.%d, keepAlive:%d", @@ -208,6 +212,10 @@ void httpCloseContextByServer(HttpThread *pThread, HttpContext *pContext) { return; } pthread_mutex_lock(&pContext->mutex); + if (pContext->signature != pContext || pContext->fd <= 0) { + return; + } + pContext->usedByEpoll = 0; pContext->parsed = false;