[svn-commits] tilghman: branch tilghman/str_substitution r184711 - in /team/tilghman/str_su...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 27 12:05:16 CDT 2009


Author: tilghman
Date: Fri Mar 27 12:05:10 2009
New Revision: 184711

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=184711
Log:
Merged revisions 184628,184630,184639,184673,184677,184693 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r184628 | file | 2009-03-27 08:57:29 -0500 (Fri, 27 Mar 2009) | 6 lines
  
  Fix a potential race condition when creating a software based mixing bridge.
  
  It was possible for no timer to become available between creating the bridge
  and starting it. We now open a timer when creating it and keep it open until the
  bridge is destroyed.
........
  r184630 | russell | 2009-03-27 09:00:18 -0500 (Fri, 27 Mar 2009) | 2 lines
  
  Change g_eid to ast_eid_default.
........
  r184639 | file | 2009-03-27 09:18:40 -0500 (Fri, 27 Mar 2009) | 2 lines
  
  Remove a cast that is not needed.
........
  r184673 | file | 2009-03-27 10:46:46 -0500 (Fri, 27 Mar 2009) | 7 lines
  
  Fix speech structure leak in the AGI speech recognition integration.
  
  The AGI dialplan applications did not destroy the speech structure automatically
  if it was not destroyed by the running AGI script. They will now do this.
  
  (issue LUMENVOX-15) 
........
  r184677 | file | 2009-03-27 10:57:28 -0500 (Fri, 27 Mar 2009) | 7 lines
  
  Fix a potential timer leak in bridge_softmix.
  
  It is possible for a bridge to be created without actually being used.
  In that scenario a timing file descriptor would be opened and not
  closed. To fix this the timing file descriptor is now closed in the
  destroy callback, not the thread function.
........
  r184693 | russell | 2009-03-27 11:21:10 -0500 (Fri, 27 Mar 2009) | 2 lines
  
  Change global_app_buf to ast_str_thread_global_buf.
........

Modified:
    team/tilghman/str_substitution/   (props changed)
    team/tilghman/str_substitution/apps/app_dumpchan.c
    team/tilghman/str_substitution/apps/app_queue.c
    team/tilghman/str_substitution/apps/app_voicemail.c
    team/tilghman/str_substitution/bridges/bridge_softmix.c
    team/tilghman/str_substitution/include/asterisk/app.h
    team/tilghman/str_substitution/include/asterisk/utils.h
    team/tilghman/str_substitution/main/app.c
    team/tilghman/str_substitution/main/asterisk.c
    team/tilghman/str_substitution/main/cli.c
    team/tilghman/str_substitution/main/event.c
    team/tilghman/str_substitution/main/pbx.c
    team/tilghman/str_substitution/pbx/pbx_dundi.c
    team/tilghman/str_substitution/res/ais/evt.c
    team/tilghman/str_substitution/res/res_agi.c

Propchange: team/tilghman/str_substitution/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/tilghman/str_substitution/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar 27 12:05:10 2009
@@ -1,1 +1,1 @@
-/trunk:1-184624
+/trunk:1-184710

Modified: team/tilghman/str_substitution/apps/app_dumpchan.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/apps/app_dumpchan.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/apps/app_dumpchan.c (original)
+++ team/tilghman/str_substitution/apps/app_dumpchan.c Fri Mar 27 12:05:10 2009
@@ -149,7 +149,7 @@
 
 static int dumpchan_exec(struct ast_channel *chan, void *data)
 {
-	struct ast_str *vars = ast_str_thread_get(&global_app_buf, 16);
+	struct ast_str *vars = ast_str_thread_get(&ast_str_thread_global_buf, 16);
 	char info[1024];
 	int level = 0;
 	static char *line = "================================================================================";

Modified: team/tilghman/str_substitution/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/apps/app_queue.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/apps/app_queue.c (original)
+++ team/tilghman/str_substitution/apps/app_queue.c Fri Mar 27 12:05:10 2009
@@ -2319,7 +2319,7 @@
 /*! \brief convert "\n" to "\nVariable: " ready for manager to use */
 static char *vars2manager(struct ast_channel *chan, char *vars, size_t len)
 {
-	struct ast_str *buf = ast_str_thread_get(&global_app_buf, len + 1);
+	struct ast_str *buf = ast_str_thread_get(&ast_str_thread_global_buf, len + 1);
 	char *tmp;
 
 	if (pbx_builtin_serialize_variables(chan, &buf)) {

Modified: team/tilghman/str_substitution/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/apps/app_voicemail.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/apps/app_voicemail.c (original)
+++ team/tilghman/str_substitution/apps/app_voicemail.c Fri Mar 27 12:05:10 2009
@@ -10323,7 +10323,7 @@
 	char *current;
 
 	/* Add 16 for fudge factor */
-	struct ast_str *str = ast_str_thread_get(&global_app_buf, strlen(value) + 16);
+	struct ast_str *str = ast_str_thread_get(&ast_str_thread_global_buf, strlen(value) + 16);
 
 	ast_str_reset(str);
 	

Modified: team/tilghman/str_substitution/bridges/bridge_softmix.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/bridges/bridge_softmix.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/bridges/bridge_softmix.c (original)
+++ team/tilghman/str_substitution/bridges/bridge_softmix.c Fri Mar 27 12:05:10 2009
@@ -91,6 +91,16 @@
 		return -1;
 	}
 
+	bridge->bridge_pvt = (void*)(unsigned long)timingfd;
+
+	return 0;
+}
+
+/*! \brief Function called when a bridge is destroyed */
+static int softmix_bridge_destroy(struct ast_bridge *bridge)
+{
+	int timingfd = (unsigned long)bridge->bridge_pvt;
+
 	ast_timer_close(timingfd);
 
 	return 0;
@@ -199,11 +209,7 @@
 /*! \brief Function which acts as the mixing thread */
 static int softmix_bridge_thread(struct ast_bridge *bridge)
 {
-	int timingfd;
-
-	if ((timingfd = ast_timer_open()) < 0) {
-		return -1;
-	}
+	int timingfd = (unsigned long)bridge->bridge_pvt;
 
 	ast_timer_set_rate(timingfd, (1000 / SOFTMIX_INTERVAL));
 
@@ -267,9 +273,6 @@
 		ao2_lock(bridge);
 	}
 
-	ast_timer_set_rate(timingfd, 0);
-	ast_timer_close(timingfd);
-
 	return 0;
 }
 
@@ -283,6 +286,7 @@
 	.formats = AST_FORMAT_SLINEAR,
 #endif
 	.create = softmix_bridge_create,
+	.destroy = softmix_bridge_destroy,
 	.join = softmix_bridge_join,
 	.leave = softmix_bridge_leave,
 	.write = softmix_bridge_write,

Modified: team/tilghman/str_substitution/include/asterisk/app.h
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/include/asterisk/app.h?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/include/asterisk/app.h (original)
+++ team/tilghman/str_substitution/include/asterisk/app.h Fri Mar 27 12:05:10 2009
@@ -32,7 +32,7 @@
 extern "C" {
 #endif
 
-AST_THREADSTORAGE_EXTERNAL(global_app_buf);
+AST_THREADSTORAGE_EXTERNAL(ast_str_thread_global_buf);
 
 /* IVR stuff */
 

Modified: team/tilghman/str_substitution/include/asterisk/utils.h
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/include/asterisk/utils.h?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/include/asterisk/utils.h (original)
+++ team/tilghman/str_substitution/include/asterisk/utils.h Fri Mar 27 12:05:10 2009
@@ -688,7 +688,7 @@
  * This is set in asterisk.conf, or determined automatically by taking the mac
  * address of an Ethernet interface on the system.
  */
-extern struct ast_eid g_eid;
+extern struct ast_eid ast_eid_default;
 
 /*!
  * \brief Fill in an ast_eid with the default eid of this machine

Modified: team/tilghman/str_substitution/main/app.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/main/app.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/main/app.c (original)
+++ team/tilghman/str_substitution/main/app.c Fri Mar 27 12:05:10 2009
@@ -52,7 +52,7 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/threadstorage.h"
 
-AST_THREADSTORAGE_PUBLIC(global_app_buf);
+AST_THREADSTORAGE_PUBLIC(ast_str_thread_global_buf);
 
 
 #define MAX_OTHER_FORMATS 10

Modified: team/tilghman/str_substitution/main/asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/main/asterisk.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/main/asterisk.c (original)
+++ team/tilghman/str_substitution/main/asterisk.c Fri Mar 27 12:05:10 2009
@@ -182,7 +182,7 @@
 
 /*! @} */
 
-struct ast_eid g_eid;
+struct ast_eid ast_eid_default;
 
 /* XXX tmpdir is a subdir of the spool directory, and no way to remap it */
 char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR;
@@ -427,7 +427,7 @@
 		return NULL;
 	}
 
-	ast_eid_to_str(eid_str, sizeof(eid_str), &g_eid);
+	ast_eid_to_str(eid_str, sizeof(eid_str), &ast_eid_default);
 
 	ast_cli(a->fd, "\nPBX Core settings\n");
 	ast_cli(a->fd, "-----------------\n");
@@ -2817,7 +2817,7 @@
 	ast_copy_string(cfg_paths.socket_path, DEFAULT_SOCKET, sizeof(cfg_paths.socket_path));
 	ast_copy_string(cfg_paths.run_dir, DEFAULT_RUN_DIR, sizeof(cfg_paths.run_dir));
 
-	ast_set_default_eid(&g_eid);
+	ast_set_default_eid(&ast_eid_default);
 
 	/* no asterisk.conf? no problem, use buildtime config! */
 	if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
@@ -2988,7 +2988,7 @@
 			struct ast_eid tmp_eid;
 			if (!ast_str_to_eid(&tmp_eid, v->value)) {
 				ast_verbose("Successfully set global EID to '%s'\n", v->value);
-				g_eid = tmp_eid;
+				ast_eid_default = tmp_eid;
 			} else
 				ast_verbose("Invalid Entity ID '%s' provided\n", v->value);
 		} else if (!strcasecmp(v->name, "lightbackground")) {

Modified: team/tilghman/str_substitution/main/cli.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/main/cli.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/main/cli.c (original)
+++ team/tilghman/str_substitution/main/cli.c Fri Mar 27 12:05:10 2009
@@ -1259,7 +1259,7 @@
 {
 	struct ast_channel *c=NULL;
 	struct timeval now;
-	struct ast_str *out = ast_str_thread_get(&global_app_buf, 16);
+	struct ast_str *out = ast_str_thread_get(&ast_str_thread_global_buf, 16);
 	char cdrtime[256];
 	char nf[256], wf[256], rf[256];
 	long elapsed_seconds=0;

Modified: team/tilghman/str_substitution/main/event.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/main/event.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/main/event.c (original)
+++ team/tilghman/str_substitution/main/event.c Fri Mar 27 12:05:10 2009
@@ -954,7 +954,7 @@
 	if (!ast_event_get_ie_raw(event, AST_EVENT_IE_EID)) {
 		/* If the event is originating on this server, add the server's
 		 * entity ID to the event. */
-		ast_event_append_ie_raw(&event, AST_EVENT_IE_EID, &g_eid, sizeof(g_eid));
+		ast_event_append_ie_raw(&event, AST_EVENT_IE_EID, &ast_eid_default, sizeof(ast_eid_default));
 	}
 
 	return event;

Modified: team/tilghman/str_substitution/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/main/pbx.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/main/pbx.c (original)
+++ team/tilghman/str_substitution/main/pbx.c Fri Mar 27 12:05:10 2009
@@ -2983,7 +2983,7 @@
 			s = ast_config_AST_SYSTEM_NAME;
 		} else if (!strcmp(var, "ENTITYID")) {
 			char workspace[20];
-			ast_eid_to_str(workspace, sizeof(workspace), &g_eid);
+			ast_eid_to_str(workspace, sizeof(workspace), &ast_eid_default);
 			s = workspace;
 		}
 	}

Modified: team/tilghman/str_substitution/pbx/pbx_dundi.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/pbx/pbx_dundi.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/pbx/pbx_dundi.c (original)
+++ team/tilghman/str_substitution/pbx/pbx_dundi.c Fri Mar 27 12:05:10 2009
@@ -4614,7 +4614,7 @@
 		ast_log(LOG_WARNING, "Unable to get host name!\n");
 	AST_LIST_LOCK(&peers);
 
-	memcpy(&global_eid, &g_eid, sizeof(global_eid));
+	memcpy(&global_eid, &ast_eid_default, sizeof(global_eid));
 
 	global_storehistory = 0;
 	ast_copy_string(secretpath, "dundi", sizeof(secretpath));

Modified: team/tilghman/str_substitution/res/ais/evt.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/res/ais/evt.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/res/ais/evt.c (original)
+++ team/tilghman/str_substitution/res/ais/evt.c Fri Mar 27 12:05:10 2009
@@ -141,7 +141,7 @@
 		return;
 	}
 
-	if (!ast_eid_cmp(&g_eid, ast_event_get_ie_raw(event, AST_EVENT_IE_EID))) {
+	if (!ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(event, AST_EVENT_IE_EID))) {
 		/* Don't feed events back in that originated locally. */
 		return;
 	}
@@ -183,7 +183,7 @@
 
 	ast_log(LOG_DEBUG, "Got an event to forward\n");
 
-	if (ast_eid_cmp(&g_eid, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID))) {
+	if (ast_eid_cmp(&ast_eid_default, ast_event_get_ie_raw(ast_event, AST_EVENT_IE_EID))) {
 		/* If the event didn't originate from this server, don't send it back out. */
 		ast_log(LOG_DEBUG, "Returning here\n");
 		return;

Modified: team/tilghman/str_substitution/res/res_agi.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/res/res_agi.c?view=diff&rev=184711&r1=184710&r2=184711
==============================================================================
--- team/tilghman/str_substitution/res/res_agi.c (original)
+++ team/tilghman/str_substitution/res/res_agi.c Fri Mar 27 12:05:10 2009
@@ -737,6 +737,10 @@
 			ast_frfree(f);
 		}
 	}
+
+	if (async_agi.speech) {
+		ast_speech_destroy(async_agi.speech);
+	}
 quit:
 	/* notify manager users this channel cannot be
 	   controlled anymore by Async AGI */
@@ -2936,6 +2940,9 @@
 			}
 		}
 	}
+	if (agi->speech) {
+		ast_speech_destroy(agi->speech);
+	}
 	/* Notify process */
 	if (send_sighup) {
 		if (pid > -1) {




More information about the svn-commits mailing list