From ff3e4e4fbd10a254c0d44632b6824c4f815f2a4c Mon Sep 17 00:00:00 2001 From: Hui Li Date: Mon, 15 Jun 2020 19:06:53 +0800 Subject: [PATCH] [modify] --- src/plugins/http/src/httpSession.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/plugins/http/src/httpSession.c b/src/plugins/http/src/httpSession.c index dfa2a4bd9f..3e43fb87f9 100644 --- a/src/plugins/http/src/httpSession.c +++ b/src/plugins/http/src/httpSession.c @@ -29,7 +29,8 @@ void httpCreateSession(HttpContext *pContext, void *taos) { pthread_mutex_lock(&server->serverMutex); - HttpSession session = {0}; + HttpSession session; + memset(&session, 0, sizeof(HttpSession); session.taos = taos; session.refCount = 1; snprintf(session.id, HTTP_SESSION_ID_LEN, "%s.%s", pContext->user, pContext->pass); @@ -122,27 +123,3 @@ bool httpInitSessions() { return true; } - -void httpRemoveExpireSessions(HttpServer *pServer) { - SHashMutableIterator *pIter = taosHashCreateIter(pServer->pSessionHash); - - while (taosHashIterNext(pIter)) { - HttpSession *pSession = taosHashIterGet(pIter); - if (pSession == NULL) continue; - - pthread_mutex_lock(&pServer->serverMutex); - if (httpSessionExpired(pSession)) { - httpResetSession(pSession); - taosHashRemove(pServer->pSessionHash, pSession->id, strlen(pSession->id)); - } - pthread_mutex_unlock(&pServer->serverMutex); - } - - taosHashDestroyIter(pIter); -} - -void httpProcessSessionExpire(void *handle, void *tmrId) { - HttpServer *pServer = (HttpServer *)handle; - httpRemoveExpireSessions(pServer); - taosTmrReset(httpProcessSessionExpire, 60000, pServer, pServer->timerHandle, &pServer->expireTimer); -} -- GitLab