[asterisk-commits] mjordan: branch 1.8 r374230 -	/branches/1.8/main/asterisk.c
    SVN commits to the Asterisk project 
    asterisk-commits at lists.digium.com
       
    Tue Oct  2 15:54:20 CDT 2012
    
    
  
Author: mjordan
Date: Tue Oct  2 15:54:16 2012
New Revision: 374230
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374230
Log:
Ensure Shutdown AMI event is still fired during Asterisk shutdown
Richard pointed out that having the manager dispose of itself gracefully
during shutdown meant that the Shutdown event will no longer get fired.
This patch moves the AMI event just prior to running the atexit callbacks.
Modified:
    branches/1.8/main/asterisk.c
Modified: branches/1.8/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/asterisk.c?view=diff&rev=374230&r1=374229&r2=374230
==============================================================================
--- branches/1.8/main/asterisk.c (original)
+++ branches/1.8/main/asterisk.c Tue Oct  2 15:54:16 2012
@@ -1763,6 +1763,15 @@
 			}
 		}
 	}
+	/* The manager event for shutdown must happen prior to ast_run_atexits, as
+	 * the manager interface will dispose of its sessions as part of its
+	 * shutdown.
+	 */
+	manager_event(EVENT_FLAG_SYSTEM, "Shutdown", "Shutdown: %s\r\n"
+			"Restart: %s\r\n",
+			ast_active_channels() ? "Uncleanly" : "Cleanly",
+			restart ? "True" : "False");
+
 	if (option_verbose)
 		ast_verbose("Executing last minute cleanups\n");
 	ast_run_atexits();
@@ -1770,7 +1779,6 @@
 	if (option_verbose && ast_opt_console)
 		ast_verbose("Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num);
 	ast_debug(1, "Asterisk ending (%d).\n", num);
-	manager_event(EVENT_FLAG_SYSTEM, "Shutdown", "Shutdown: %s\r\nRestart: %s\r\n", ast_active_channels() ? "Uncleanly" : "Cleanly", restart ? "True" : "False");
 	if (ast_socket > -1) {
 		pthread_cancel(lthread);
 		close(ast_socket);
    
    
More information about the asterisk-commits
mailing list