[svn-commits] mjordan: trunk r374259 - in /trunk: ./ main/asterisk.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Oct 2 16:26:31 CDT 2012


Author: mjordan
Date: Tue Oct  2 16:26:27 2012
New Revision: 374259

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374259
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.
........

Merged revisions 374230 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 374231 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 374248 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    trunk/   (props changed)
    trunk/main/asterisk.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/asterisk.c?view=diff&rev=374259&r1=374258&r2=374259
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Tue Oct  2 16:26:27 2012
@@ -1869,11 +1869,10 @@
 			}
 		}
 	}
-	ast_verb(0, "Executing last minute cleanups\n");
-	ast_run_atexits();
-	/* Called on exit */
-	ast_verb(0, "Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num);
-	ast_debug(1, "Asterisk ending (%d).\n", num);
+	/* 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.
+	 */
 	/*** DOCUMENTATION
 		<managerEventInstance>
 			<synopsis>Raised when Asterisk is shutdown or restarted.</synopsis>
@@ -1893,7 +1892,16 @@
 			</syntax>
 		</managerEventInstance>
 	***/
-	manager_event(EVENT_FLAG_SYSTEM, "Shutdown", "Shutdown: %s\r\nRestart: %s\r\n", ast_active_channels() ? "Uncleanly" : "Cleanly", restart ? "True" : "False");
+	manager_event(EVENT_FLAG_SYSTEM, "Shutdown", "Shutdown: %s\r\n"
+		"Restart: %s\r\n",
+		ast_active_channels() ? "Uncleanly" : "Cleanly",
+		restart ? "True" : "False");
+
+	ast_verb(0, "Executing last minute cleanups\n");
+	ast_run_atexits();
+	/* Called on exit */
+	ast_verb(0, "Asterisk %s ending (%d).\n", ast_active_channels() ? "uncleanly" : "cleanly", num);
+	ast_debug(1, "Asterisk ending (%d).\n", num);
 	if (ast_socket > -1) {
 		pthread_cancel(lthread);
 		close(ast_socket);




More information about the svn-commits mailing list