fix the issue #279
This commit is contained in:
parent
47b242e0f2
commit
c7e0709113
|
@ -94,11 +94,17 @@ void httpFreeContext(HttpServer *pServer, HttpContext *pContext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void httpCleanUpContext(HttpThread *pThread, HttpContext *pContext) {
|
void httpCleanUpContextTimer(HttpContext *pContext) {
|
||||||
// for not keep-alive
|
|
||||||
if (pContext->readTimer != NULL) {
|
if (pContext->readTimer != NULL) {
|
||||||
taosTmrStopA(pContext->readTimer);
|
taosTmrStopA(pContext->readTimer);
|
||||||
|
pContext->readTimer = NULL;
|
||||||
|
httpTrace("context:%p, fd:%d, ip:%s, close read timer", pContext, pContext->fd, pContext->ipstr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void httpCleanUpContext(HttpThread *pThread, HttpContext *pContext) {
|
||||||
|
// for not keep-alive
|
||||||
|
httpCleanUpContextTimer(pContext);
|
||||||
|
|
||||||
if (pContext->fd >= 0) {
|
if (pContext->fd >= 0) {
|
||||||
epoll_ctl(pThread->pollFd, EPOLL_CTL_DEL, pContext->fd, NULL);
|
epoll_ctl(pThread->pollFd, EPOLL_CTL_DEL, pContext->fd, NULL);
|
||||||
|
@ -157,6 +163,7 @@ bool httpInitContext(HttpContext *pContext) {
|
||||||
pContext->usedByApp = 0;
|
pContext->usedByApp = 0;
|
||||||
pContext->reqType = HTTP_REQTYPE_OTHERS;
|
pContext->reqType = HTTP_REQTYPE_OTHERS;
|
||||||
pContext->encodeMethod = NULL;
|
pContext->encodeMethod = NULL;
|
||||||
|
pContext->readTimer = NULL;
|
||||||
memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd));
|
memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd));
|
||||||
|
|
||||||
HttpParser *pParser = &pContext->parser;
|
HttpParser *pParser = &pContext->parser;
|
||||||
|
@ -342,10 +349,12 @@ bool httpReadData(HttpThread *pThread, HttpContext *pContext) {
|
||||||
taosTmrReset(httpCloseContextByServerFromTimer, HTTP_EXPIRED_TIME, pContext, pThread->pServer->timerHandle, &pContext->readTimer);
|
taosTmrReset(httpCloseContextByServerFromTimer, HTTP_EXPIRED_TIME, pContext, pThread->pServer->timerHandle, &pContext->readTimer);
|
||||||
return false;
|
return false;
|
||||||
} else if (ret == HTTP_CHECK_BODY_SUCCESS){
|
} else if (ret == HTTP_CHECK_BODY_SUCCESS){
|
||||||
|
httpCleanUpContextTimer(pContext);
|
||||||
httpDump("context:%p, fd:%d, ip:%s, thread:%s, numOfFds:%d, body:\n%s",
|
httpDump("context:%p, fd:%d, ip:%s, thread:%s, numOfFds:%d, body:\n%s",
|
||||||
pContext, pContext->fd, pContext->ipstr, pContext->pThread->label, pContext->pThread->numOfFds, pContext->parser.data.pos);
|
pContext, pContext->fd, pContext->ipstr, pContext->pThread->label, pContext->pThread->numOfFds, pContext->parser.data.pos);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
httpCleanUpContextTimer(pContext);
|
||||||
httpError("context:%p, fd:%d, ip:%s, failed to read http body, close connect", pContext, pContext->fd, pContext->ipstr);
|
httpError("context:%p, fd:%d, ip:%s, failed to read http body, close connect", pContext, pContext->fd, pContext->ipstr);
|
||||||
httpCloseContextByServer(pThread, pContext);
|
httpCloseContextByServer(pThread, pContext);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue