From 1c5b70b2a647f925b4f4158bb7362dd8f65b98df Mon Sep 17 00:00:00 2001 From: ps Date: Sat, 8 Jan 2011 01:38:29 +0000 Subject: [PATCH] make the main loop lists the children id instead of the pthread_id --- src/hermes.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hermes.cpp b/src/hermes.cpp index cfce035..6bb2253 100644 --- a/src/hermes.cpp +++ b/src/hermes.cpp @@ -60,7 +60,7 @@ LOGGER_CLASS hermes_log; //print at the start of log messages __thread unsigned long connection_id; -list children; +list children; #ifdef HAVE_SSL pthread_mutex_t ssl_locks[CRYPTO_NUM_LOCKS]={PTHREAD_MUTEX_INITIALIZER}; @@ -223,7 +223,7 @@ main { LDEB("New thread created [" + Utils::ulongtostr(nconns) + "] thread_id: " + Utils::ulongtostr(thread)); pthread_mutex_lock(&childrenlist_mutex); - children.push_back(thread); + children.push_back(nconns); pthread_mutex_unlock(&childrenlist_mutex); } } @@ -321,7 +321,7 @@ void *cleaner_thread_run(void *) pthread_mutex_lock(&childrenlist_mutex); ss << children.size() << " threads running: "; - for(list::iterator i=children.begin();i!=children.end();i++) + for(list::iterator i=children.begin();i!=children.end();i++) ss << "[ " << *i << " ] "; pthread_mutex_unlock(&childrenlist_mutex); ss << endl; @@ -364,7 +364,7 @@ void *thread_main(void *info_stack) client.setFD(peerinfo.new_fd); p.setOutside(client); p.run(peerinfo.peer_address); - remove_thread_from_list(pthread_self()); + remove_thread_from_list(connection_id); } catch(Exception &e) {