From 88bdaea8c3ef28680a83ee6c82e77e97c6116fb4 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 9 Jun 2004 16:52:38 +0000 Subject: - Log disconnecting connections better - Better logging shutdown and cleanup - Initialize thread memory --- daemon/httpauthd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'daemon') diff --git a/daemon/httpauthd.c b/daemon/httpauthd.c index 03a331a..28aacf7 100644 --- a/daemon/httpauthd.c +++ b/daemon/httpauthd.c @@ -230,7 +230,7 @@ int main(int argc, char* argv[]) struct sockaddr_any sany; /* Create the thread buffers */ - threads = (httpauth_thread_t*)malloc(sizeof(httpauth_thread_t) * g_maxthreads); + threads = (httpauth_thread_t*)calloc(g_maxthreads, sizeof(httpauth_thread_t)); if(!threads) errx(1, "out of memory"); @@ -343,6 +343,7 @@ int main(int argc, char* argv[]) { if(threads[i].fd == -1) { + ha_messagex(LOG_DEBUG, "cleaning up completed thread"); pthread_join(threads[i].tid, NULL); threads[i].tid = 0; } @@ -392,6 +393,8 @@ int main(int argc, char* argv[]) finally: + ha_messagex(LOG_DEBUG, "performing cleanup..."); + /* Uninitialize all the handlers */ for(h = g_handlers; h; h = h->next) { @@ -409,10 +412,12 @@ finally: /* Clean up memory and stuff */ ha_buffree(&cbuf); - /* Close the mutex */ pthread_mutex_destroy(&g_mutex); pthread_mutexattr_destroy(&g_mutexattr); + + ha_messagex(LOG_DEBUG, "done"); + return r == -1 ? 1 : 0; } @@ -456,6 +461,8 @@ static void* httpauth_thread(void* arg) /* call the processor */ r = httpauth_processor(thread->fd, thread->fd); + ha_messagex(LOG_INFO, "closed connection: %d", thread->fd); + /* mark this as done */ thread->fd = -1; -- cgit v1.2.3