changeset 122:e66a82a739fa

Fix termination steps
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 09 Dec 2009 17:57:27 +0900
parents a66027056162
children 960fa8048805
files freeDiameter/dispatch.c freeDiameter/fD.h freeDiameter/main.c freeDiameter/routing.c
diffstat 4 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/freeDiameter/dispatch.c	Wed Dec 09 17:47:49 2009 +0900
+++ b/freeDiameter/dispatch.c	Wed Dec 09 17:57:27 2009 +0900
@@ -260,9 +260,6 @@
 
 	/* Then if needed, cancel the thread */
 	
-	/* Remove all remaining handlers */
-	fd_disp_unregister_all();
-	
 	return ENOTSUP;
 }
 
--- a/freeDiameter/fD.h	Wed Dec 09 17:47:49 2009 +0900
+++ b/freeDiameter/fD.h	Wed Dec 09 17:57:27 2009 +0900
@@ -107,6 +107,12 @@
 /* Routing */
 int fd_rt_init(void);
 int fd_rt_fini(void);
+int fd_rt_cleanup(void);
+
+/* Dispatch */
+int fd_disp_init(void);
+int fd_disp_cleanstop(void);
+int fd_disp_fini(void);
 
 /* Sentinel for the sent requests list */
 struct sr_list {
--- a/freeDiameter/main.c	Wed Dec 09 17:47:49 2009 +0900
+++ b/freeDiameter/main.c	Wed Dec 09 17:57:27 2009 +0900
@@ -169,6 +169,9 @@
 	
 	CHECK_FCT_DO( fd_ext_fini(), /* Cleaup all extensions */ );
 	TODO("Cleanup queues (dump all remaining messages ?)");
+	CHECK_FCT_DO( fd_rt_cleanup(), /* destroy remaining handlers */ );
+	fd_disp_unregister_all(); /* destroy remaining handlers */
+	
 	
 	CHECK_FCT_DO( fd_thr_term(&sig_th), /* continue */ );
 	
--- a/freeDiameter/routing.c	Wed Dec 09 17:47:49 2009 +0900
+++ b/freeDiameter/routing.c	Wed Dec 09 17:57:27 2009 +0900
@@ -859,12 +859,18 @@
 	return 0;
 }
 
-/* Terminate the routing module */
+/* Terminate the routing threads */
 int fd_rt_fini(void)
 {
 	CHECK_FCT_DO( fd_thr_term(&rt_in ), /* continue */);
 	CHECK_FCT_DO( fd_thr_term(&rt_out), /* continue */);
 	
+	return 0;
+}
+
+/* Cleanup handlers */
+int fd_rt_cleanup(void)
+{
 	/* Cleanup all remaining handlers */
 	while (!FD_IS_LIST_EMPTY(&rt_fwd_list)) {
 		CHECK_FCT_DO( fd_rt_fwd_unregister ( (void *)rt_fwd_list.next, NULL ), /* continue */ );
"Welcome to our mercurial repository"