diff options
Diffstat (limited to 'daemon/httpauthd.c')
-rw-r--r-- | daemon/httpauthd.c | 11 |
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; |