Index: libfdcore/cnxctx.c
===================================================================
--- libfdcore/cnxctx.c	(revision 1186)
+++ libfdcore/cnxctx.c	(revision 1190)
@@ -611,5 +611,5 @@
 	/* An unrecoverable error occurred, stop the daemon */
 	ASSERT(0);
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );	
+	CHECK_FCT_DO(fd_core_shutdown(), );	
 }
 
@@ -843,6 +843,5 @@
 			{ 
 				free_rcvdata(&rcv_data);
-				CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
-				return NULL; 
+				goto fatal; 
 			} );
 		
@@ -855,5 +854,5 @@
 fatal:
 	/* An unrecoverable error occurred, stop the daemon */
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+	CHECK_FCT_DO(fd_core_shutdown(), );
 	goto out;
 }
@@ -908,5 +907,5 @@
 fatal:
 	/* An unrecoverable error occurred, stop the daemon */
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+	CHECK_FCT_DO(fd_core_shutdown(), );
 	goto out;
 }
@@ -1099,5 +1098,5 @@
 			{ 
 				free_rcvdata(&rcv_data);
-				CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+				CHECK_FCT_DO(fd_core_shutdown(), );
 				return ret; 
 			} );
Index: libfdcore/core.c
===================================================================
--- libfdcore/core.c	(revision 1182)
+++ libfdcore/core.c	(revision 1190)
@@ -149,5 +149,5 @@
 				break;
 			
-			case FDEV_TERMINATE:
+			case FDEV_TERMINATE_INT:
 				goto end;
 			
@@ -327,4 +327,6 @@
 	enum core_state cur_state = core_state_get();
 	
+	LOG_F("Initiating freeDiameter shutdown sequence (%d)", cur_state);
+		
 	if (cur_state < CORE_RUNNING) {
 		/* Calling application must make sure the initialization is not ongoing in a separate thread... */
@@ -339,5 +341,5 @@
 	} else if (cur_state == CORE_RUNNING) {
 		core_state_set(CORE_SHUTDOWN);
-		CHECK_FCT( fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL) );
+		CHECK_FCT( fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE_INT, 0, NULL) );
 	}
 	
Index: libfdcore/events.c
===================================================================
--- libfdcore/events.c	(revision 1127)
+++ libfdcore/events.c	(revision 1190)
@@ -105,5 +105,5 @@
 	#define case_str( _val )\
 		case _val : return #_val
-		case_str(FDEV_TERMINATE);
+		case_str(FDEV_TERMINATE_INT);
 		case_str(FDEV_TRIGGER);
 		
Index: libfdcore/p_cnx.c
===================================================================
--- libfdcore/p_cnx.c	(revision 1187)
+++ libfdcore/p_cnx.c	(revision 1190)
@@ -314,5 +314,5 @@
 
 		/* Generate a termination event */
-		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+		CHECK_FCT_DO(fd_core_shutdown(), );
 	}
 	
Index: libfdcore/p_expiry.c
===================================================================
--- libfdcore/p_expiry.c	(revision 740)
+++ libfdcore/p_expiry.c	(revision 1190)
@@ -87,5 +87,5 @@
 	TRACE_DEBUG(INFO, "An error occurred in peers module! GC thread is terminating...");
 	ASSERT(0);
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+	CHECK_FCT_DO(fd_core_shutdown(), );
 	return NULL;
 }
@@ -139,5 +139,5 @@
 
 	TRACE_DEBUG(INFO, "An error occurred in peers module! Expiry thread is terminating...");
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+	CHECK_FCT_DO(fd_core_shutdown(), );
 	return NULL;
 }
Index: libfdcore/routing_dispatch.c
===================================================================
--- libfdcore/routing_dispatch.c	(revision 1186)
+++ libfdcore/routing_dispatch.c	(revision 1190)
@@ -1115,5 +1115,5 @@
 fatal_error:
 	TRACE_DEBUG(INFO, "An unrecoverable error occurred, %s thread is terminating...", action_name);
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+	CHECK_FCT_DO(fd_core_shutdown(), );
 	
 end:	
Index: libfdcore/sctp3436.c
===================================================================
--- libfdcore/sctp3436.c	(revision 1186)
+++ libfdcore/sctp3436.c	(revision 1190)
@@ -130,5 +130,5 @@
 fatal:
 	/* An unrecoverable error occurred, stop the daemon */
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+	CHECK_FCT_DO(fd_core_shutdown(), );
 	goto out;
 }
Index: libfdcore/server.c
===================================================================
--- libfdcore/server.c	(revision 1189)
+++ libfdcore/server.c	(revision 1190)
@@ -304,5 +304,5 @@
 	/* Send error signal to the core */
 	LOG_F( "An error occurred in server module! Thread is terminating...");
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL), );
+	CHECK_FCT_DO(fd_core_shutdown(), );
 
 	return NULL;
