summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-06-09 16:52:38 +0000
committerStef Walter <stef@memberwebs.com>2004-06-09 16:52:38 +0000
commit88bdaea8c3ef28680a83ee6c82e77e97c6116fb4 (patch)
treead7c156ae575dda7b49118d1faa189a956e86898 /daemon
parent66d68a58fbbeacfaa51f5210e9d6a549a677014f (diff)
- Log disconnecting connections better
- Better logging shutdown and cleanup - Initialize thread memory
Diffstat (limited to 'daemon')
-rw-r--r--daemon/httpauthd.c11
1 files changed, 9 insertions, 2 deletions
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;