[asterisk-commits] jrose: branch 1.8 r310726 - /branches/1.8/main/channel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 14 16:17:20 CDT 2011
Author: jrose
Date: Mon Mar 14 16:17:13 2011
New Revision: 310726
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310726
Log:
Moves data store destruction from channel destruction to hangup in channel.c
This moves the data store destruction and app signaling events for a call to ast_hangup so that threads which wait for data store destruction
don't become stuck forever when attached to an application/function/etc that keeps the channel open.
(closes issue #18742)
Reported by: jkister
Patches:
patch.diff uploaded by jrose (license 1225)
Tested by: jkister, jcovert, jrose
Review: https://reviewboard.asterisk.org/r/1136/
Modified:
branches/1.8/main/channel.c
Modified: branches/1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/channel.c?view=diff&rev=310726&r1=310725&r2=310726
==============================================================================
--- branches/1.8/main/channel.c (original)
+++ branches/1.8/main/channel.c Mon Mar 14 16:17:13 2011
@@ -2313,7 +2313,6 @@
struct ast_var_t *vardata;
struct ast_frame *f;
struct varshead *headp;
- struct ast_datastore *datastore;
char device_name[AST_CHANNEL_NAME];
if (chan->name) {
@@ -2321,18 +2320,6 @@
ast_cel_report_event(chan, AST_CEL_CHANNEL_END, NULL, NULL, NULL);
ast_cel_check_retire_linkedid(chan);
}
-
- /* Get rid of each of the data stores on the channel */
- ast_channel_lock(chan);
- while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry)))
- /* Free the data store */
- ast_datastore_free(datastore);
- ast_channel_unlock(chan);
-
- /* Lock and unlock the channel just to be sure nobody has it locked still
- due to a reference that was stored in a datastore. (i.e. app_chanspy) */
- ast_channel_lock(chan);
- ast_channel_unlock(chan);
if (chan->tech_pvt) {
ast_log(LOG_WARNING, "Channel '%s' may not have been hung up properly\n", chan->name);
@@ -2684,6 +2671,7 @@
{
int res = 0;
char extra_str[64]; /* used for cel logging below */
+ struct ast_datastore *datastore;
/* Don't actually hang up a channel that will masquerade as someone else, or
if someone is going to masquerade as us */
@@ -2789,6 +2777,15 @@
chan->cdr = NULL;
ast_channel_unlock(chan);
}
+
+ /* Get rid of each of the data stores on the channel */
+ ast_channel_lock(chan);
+ while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry))) {
+ /* Free the data store */
+ ast_datastore_free(datastore);
+ }
+ ast_channel_unlock(chan);
+
chan = ast_channel_release(chan);
More information about the asterisk-commits
mailing list