summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-10-02 21:26:27 +0000
committerMatthew Jordan <mjordan@digium.com>2012-10-02 21:26:27 +0000
commitbfe35ee0b0930795d0471f3b0a984a1616ffa54d (patch)
treeba83700cded9f10df9b5c5f2f714f0425243d3ce /main
parent0be8d5c64cf1a59d5de04c7c7c24f6624b95eede (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 03c9962b3..78a481d7c 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1869,11 +1869,10 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
}
}
}
- 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 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
</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);