summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-02-11 17:39:13 +0000
committerRichard Mudgett <rmudgett@digium.com>2015-02-11 17:39:13 +0000
commite2d3215b836004b913cd386a3241c312fcee621d (patch)
tree715ef97cfdb6929ae2660c42f266475d41891173 /main/channel.c
parent5a17ed7a38c6539fe335c8d1eda0ed866729c22a (diff)
HTTP: Stop accepting requests on final system shutdown.
There are three CLI commands to stop and restart Asterisk each. 1) core stop/restart now - Hangup all calls and stop or restart Asterisk. New channels are prevented while the shutdown request is pending. 2) core stop/restart gracefully - Stop or restart Asterisk when there are no calls remaining in the system. New channels are prevented while the shutdown request is pending. 3) core stop/restart when convenient - Stop or restart Asterisk when there are no calls in the system. New calls are not prevented while the shutdown request is pending. ARI has made stopping/restarting Asterisk more problematic. While a shutdown request is pending it is desirable to continue to process ARI HTTP requests for current calls. To handle the current calls while a shutdown request is pending, a new committed to shutdown phase is needed so ARI applications can deal with the calls until the system is fully committed to shutdown. * Added a new shutdown committed phase so ARI applications can deal with calls until the final committed to shutdown phase is reached. * Made refuse new HTTP requests when the system has reached the final system shutdown phase. Starting anything while the system is actively releasing resources and unloading modules is not a good thing. * Split the bridging framework shutdown to not cleanup the global bridging containers when shutting down in a hurry. This is similar to how other modules prevent crashes on rapid system shutdown. * Moved ast_begin_shutdown(), ast_cancel_shutdown(), and ast_shutting_down(). You should not have to include channel.h just to access these system functions. ASTERISK-24752 #close Reported by: Matthew Jordan Review: https://reviewboard.asterisk.org/r/4399/ ........ Merged revisions 431692 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/main/channel.c b/main/channel.c
index aab8e228c..f8ae442b9 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -100,9 +100,6 @@ struct ast_epoll_data {
#define MONITOR_DELAY 150 * 8 /*!< 150 ms of MONITORING DELAY */
#endif
-/*! \brief Prevent new channel allocation if shutting down. */
-static int shutting_down;
-
static int chancount;
unsigned long global_fin, global_fout;
@@ -507,13 +504,9 @@ static int ast_channel_softhangup_cb(void *obj, void *arg, int flags)
return 0;
}
-void ast_begin_shutdown(int hangup)
+void ast_softhangup_all(void)
{
- shutting_down = 1;
-
- if (hangup) {
- ao2_callback(channels, OBJ_NODATA | OBJ_MULTIPLE, ast_channel_softhangup_cb, NULL);
- }
+ ao2_callback(channels, OBJ_NODATA | OBJ_MULTIPLE, ast_channel_softhangup_cb, NULL);
}
/*! \brief returns number of active/allocated channels */
@@ -527,18 +520,6 @@ int ast_undestroyed_channels(void)
return ast_atomic_fetchadd_int(&chancount, 0);
}
-/*! \brief Cancel a shutdown in progress */
-void ast_cancel_shutdown(void)
-{
- shutting_down = 0;
-}
-
-/*! \brief Returns non-zero if Asterisk is being shut down */
-int ast_shutting_down(void)
-{
- return shutting_down;
-}
-
/*! \brief Set when to hangup channel */
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
{