From df83e2eb65a6727777302c66d07bd692c633a1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 14 Oct 2016 00:37:51 +0000 Subject: [PATCH] Use sessmap for epoll() --- lib/MySQL_Thread.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 7707eb62f..29f95f769 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -2114,6 +2114,7 @@ __run_skip_1a: // here we handle epoll_wait() if (idle_maintenance_thread) { if (rc) { +/* int epi=mysql_sessions->len; int i=0; while (epi) { @@ -2145,6 +2146,34 @@ __run_skip_1a: } } } +*/ + int i; + for (i=0; iindex(sess_pos); + MySQL_Data_Stream *tmp_myds=mysess->client_myds; + int dsidx=tmp_myds->poll_fds_idx; + //fprintf(stderr,"Removing session %p, DS %p idx %d\n",mysess,tmp_myds,dsidx); + mypolls.remove_index_fast(dsidx); + tmp_myds->mypolls=NULL; + mysess->thread=NULL; + // we first delete the association in sessmap + sessmap.erase(mysess->thread_session_id); + if (mysql_sessions->len-1 > 0) { + // take the last element and adjust the map + MySQL_Session *mysess_last=(MySQL_Session *)mysql_sessions->index(mysql_sessions->len-1); + sessmap[mysess_last->thread_session_id]=sess_pos; + } + unregister_session(sess_pos); + resume_mysql_sessions->add(mysess); + epoll_ctl(efd, EPOLL_CTL_DEL, tmp_myds->fd, NULL); + } + } + } for (i=0; i