]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 374231 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Tue, 2 Oct 2012 21:26:14 +0000 (21:26 +0000)
committerAutomerge script <automerge@asterisk.org>
Tue, 2 Oct 2012 21:26:14 +0000 (21:26 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r374231 | mjordan | 2012-10-02 16:12:30 -0500 (Tue, 02 Oct 2012) | 9 lines

  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
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10-digiumphones@374258 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/asterisk.c

index 4e07ac7c265664506cf164438841282311f83d41..cefb66675384d9df3d1a5043788df2fea15bab13 100644 (file)
@@ -1775,6 +1775,15 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
                        }
                }
        }
+       /* 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();
@@ -1782,7 +1791,6 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
        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);