From b5e3990d7a1c42d66afea3f713264eb6166e7c72 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 21 Jan 2007 10:41:50 +0000 Subject: [PATCH] * shut down libical apropriate. * first guesses of destroying remaining session objects --- citadel/serv_calendar.c | 10 +++++++--- citadel/serv_extensions.h | 1 + citadel/sysdep.c | 22 +++++++++++++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/citadel/serv_calendar.c b/citadel/serv_calendar.c index 7833ab84f..b7871e8e5 100644 --- a/citadel/serv_calendar.c +++ b/citadel/serv_calendar.c @@ -1770,6 +1770,7 @@ void ical_send_out_invitations(icalcomponent *cal) { valid = validate_recipients(attendees_string); CtdlSubmitMsg(msg, valid, ""); CtdlFreeMessage(msg); + free (valid); } } free(serialized_request); @@ -2163,6 +2164,9 @@ char *serv_calendar_init(void) - - - +void serv_calendar_destroy(void) +{ +#ifdef CITADEL_WITH_CALENDAR_SERVICE + icaltimezone_free_builtin_timezones(); +#endif +} diff --git a/citadel/serv_extensions.h b/citadel/serv_extensions.h index b4930e622..4ed2b5369 100644 --- a/citadel/serv_extensions.h +++ b/citadel/serv_extensions.h @@ -12,6 +12,7 @@ */ char *serv_bio_init(void); char *serv_calendar_init(void); +void serv_calendar_destroy(void); char *serv_notes_init(void); char *serv_ldap_init(void); char *serv_chat_init(void); diff --git a/citadel/sysdep.c b/citadel/sysdep.c index f12c6babc..8986c9ed7 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -721,6 +721,7 @@ int client_getln(char *buf, int bufsize) void sysdep_master_cleanup(void) { struct ServiceFunctionHook *serviceptr; +///// DestroyWorkerList(); /* * close all protocol master sockets */ @@ -745,6 +746,7 @@ void sysdep_master_cleanup(void) { #ifdef HAVE_OPENSSL destruct_ssl(); #endif + serv_calendar_destroy(); CtdlDestroyProtoHooks(); CtdlDestroyDeleteHooks(); CtdlDestroyXmsgHooks(); @@ -755,7 +757,6 @@ void sysdep_master_cleanup(void) { CtdlDestroyFixedOutputHooks(); CtdlDestroySessionHooks(); CtdlDestroyServiceHook(); - DestroyWorkerList(); } @@ -947,6 +948,25 @@ void create_worker(void) { void DestroyWorkerList(void) { + struct CitContext *ptr; /* general-purpose utility pointer */ + struct CitContext *rem = NULL; /* list of sessions to be destroyed */ + + begin_critical_section(S_SESSION_TABLE); + ptr = ContextList; + while (ptr != NULL){ + /* Remove the session from the active list */ + rem = ptr->next; + --num_sessions; + + lprintf(CTDL_DEBUG, "Purging session %d\n", rem->cs_pid); + end_critical_section(S_SESSION_TABLE); + RemoveContext(ptr); + begin_critical_section(S_SESSION_TABLE); + free (ptr); + ptr = rem; + } + end_critical_section(S_SESSION_TABLE); + struct worker_node *cur, *p; cur = worker_list; while (cur != NULL) -- 2.30.2