diff --git a/src/plugins/http/inc/httpContext.h b/src/plugins/http/inc/httpContext.h index b016da2dd3a75bc4e51f29e3f9344458d11badea..af52fdd1ebbfe70fee3f278f94aa95faa1f4caba 100644 --- a/src/plugins/http/inc/httpContext.h +++ b/src/plugins/http/inc/httpContext.h @@ -25,7 +25,7 @@ const char *httpContextStateStr(HttpContextState state); HttpContext *httpCreateContext(SOCKET fd); bool httpInitContext(HttpContext *pContext); HttpContext *httpGetContext(void * pContext); -void httpReleaseContext(HttpContext *pContext, bool clearRes); +void httpReleaseContext(HttpContext *pContext/*, bool clearRes*/); void httpCloseContextByServer(HttpContext *pContext); void httpCloseContextByApp(HttpContext *pContext); void httpNotifyContextClose(HttpContext *pContext); diff --git a/src/plugins/http/src/httpContext.c b/src/plugins/http/src/httpContext.c index 13f706af653e9c5c1b9fb0a4c602355b001d0cac..51adef11b9af3ebb83537024edbb3ba369aaeb03 100644 --- a/src/plugins/http/src/httpContext.c +++ b/src/plugins/http/src/httpContext.c @@ -146,20 +146,20 @@ HttpContext *httpGetContext(void *ptr) { return NULL; } -void httpReleaseContext(HttpContext *pContext, bool clearRes) { +void httpReleaseContext(HttpContext *pContext/*, bool clearRes*/) { int32_t refCount = atomic_sub_fetch_32(&pContext->refCount, 1); if (refCount < 0) { httpError("context:%p, is already released, refCount:%d", pContext, refCount); return; } - + /* if (clearRes) { if (pContext->parser) { httpClearParser(pContext->parser); } memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd)); } - + */ HttpContext **ppContext = pContext->ppContext; httpTrace("context:%p, is released, data:%p refCount:%d", pContext, ppContext, refCount); @@ -217,7 +217,7 @@ void httpCloseContextByApp(HttpContext *pContext) { httpContextStateStr(pContext->state), pContext->state); } - httpReleaseContext(pContext, true); + httpReleaseContext(pContext/*, true*/); } void httpCloseContextByServer(HttpContext *pContext) { @@ -235,5 +235,5 @@ void httpCloseContextByServer(HttpContext *pContext) { pContext->parsed = false; httpRemoveContextFromEpoll(pContext); - httpReleaseContext(pContext, true); + httpReleaseContext(pContext/*, true*/); } diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index a5f40fdc4cf89f6322d310ca2093336862a9045d..4dcf3d550177ff6747a2af1c0c9ff561a3b0dd29 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -177,7 +177,7 @@ static void httpProcessHttpData(void *param) { if (!httpAlterContextState(pContext, HTTP_CONTEXT_STATE_READY, HTTP_CONTEXT_STATE_READY)) { httpDebug("context:%p, fd:%d, state:%s, not in ready state, ignore read events", pContext, pContext->fd, httpContextStateStr(pContext->state)); - httpReleaseContext(pContext, true); + httpReleaseContext(pContext/*, true*/); continue; } @@ -191,7 +191,7 @@ static void httpProcessHttpData(void *param) { (*(pThread->processData))(pContext); atomic_fetch_add_32(&pServer->requestNum, 1); } else { - httpReleaseContext(pContext, false); + httpReleaseContext(pContext/*, false*/); } } } @@ -275,7 +275,7 @@ static void *httpAcceptHttpConnection(void *arg) { httpError("context:%p, fd:%d, ip:%s, thread:%s, failed to add http fd for epoll, error:%s", pContext, connFd, pContext->ipstr, pThread->label, strerror(errno)); taosCloseSocket(pContext->fd); - httpReleaseContext(pContext, true); + httpReleaseContext(pContext/*, true*/); continue; } diff --git a/src/plugins/http/src/httpSql.c b/src/plugins/http/src/httpSql.c index 4e9b54b7bd2b25b2a8bbdd29e6d54ae314b7519d..b345c1531f1f6904470a2e9dbae361834ef32fff 100644 --- a/src/plugins/http/src/httpSql.c +++ b/src/plugins/http/src/httpSql.c @@ -376,6 +376,8 @@ void httpExecCmd(HttpContext *pContext) { httpCloseContextByApp(pContext); break; } + + memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd)); } void httpProcessRequestCb(void *param, TAOS_RES *result, int32_t code) {