[asterisk-commits] file: branch file/bridging r171523 - in /team/file/bridging: apps/ bridges/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 27 06:35:12 CST 2009


Author: file
Date: Tue Jan 27 06:35:12 2009
New Revision: 171523

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=171523
Log:
Make some changes mentioned by Russell on reviewboard.

Modified:
    team/file/bridging/apps/app_confbridge.c
    team/file/bridging/bridges/bridge_multiplexed.c

Modified: team/file/bridging/apps/app_confbridge.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/apps/app_confbridge.c?view=diff&rev=171523&r1=171522&r2=171523
==============================================================================
--- team/file/bridging/apps/app_confbridge.c (original)
+++ team/file/bridging/apps/app_confbridge.c Tue Jan 27 06:35:12 2009
@@ -111,7 +111,7 @@
  * bridge lock if it is important.
  */
 
-static char *app = "ConfBridge";
+static const char *app = "ConfBridge";
 
 enum {
 	OPTION_ADMIN = (1 << 0),             /*!< Set if the caller is an administrator */
@@ -146,8 +146,8 @@
 /* Maximum length of a conference bridge name */
 #define MAX_CONF_NAME 32
 
-/* Maximum number of buckets our conference bridges container can have */
-#define MAX_CONFERENCE_BRIDGE_BUCKETS 53
+/* Number of buckets our conference bridges container can have */
+#define CONFERENCE_BRIDGE_BUCKETS 53
 
 /*! \brief The structure that represents a conference bridge */
 struct conference_bridge {
@@ -188,7 +188,7 @@
 static int conference_bridge_cmp_cb(void *obj, void *arg, int flags)
 {
 	const struct conference_bridge *conference_bridge0 = obj, *conference_bridge1 = arg;
-	return (!strcasecmp(conference_bridge0->name, conference_bridge1->name) ? CMP_MATCH : 0);
+	return (!strcasecmp(conference_bridge0->name, conference_bridge1->name) ? CMP_MATCH | CMP_STOP : 0);
 }
 
 /*!
@@ -439,7 +439,6 @@
 		
 		/* Link it into the conference bridges container */
 		ao2_link(conference_bridges, conference_bridge);
-		ao2_ref(conference_bridge, -1);
 
 		ast_debug(1, "Created conference bridge '%s' and linked to container '%p'\n", name, conference_bridges);
 	}
@@ -480,10 +479,8 @@
  * \param conference_bridge The conference bridge to leave
  * \param conference_bridge_user The conference bridge user structure
  *
- * \retval 0 success
- * \retval -1 failure
- */
-static int leave_conference_bridge(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
+ */
+static void  leave_conference_bridge(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
 {
 	ao2_lock(conference_bridge);
 
@@ -531,6 +528,8 @@
 				ast_bridge_unsuspend(conference_bridge->bridge, first_participant->chan);
 			}
 		}
+	} else {
+		ao2_unlink(conference_bridges, conference_bridge);
 	}
 
 	/* Done mucking with the conference bridge, huzzah */
@@ -538,7 +537,7 @@
 
 	ao2_ref(conference_bridge, -1);
 
-	return 0;
+	return;
 }
 
 /*!
@@ -764,7 +763,8 @@
 
 	/* Easy as pie, depart this channel from the conference bridge */
 	leave_conference_bridge(conference_bridge, &conference_bridge_user);
-
+	conference_bridge = NULL;
+	
 	/* Can't forget to clean up the features structure, or else we risk a memory leak */
 	ast_bridge_features_cleanup(&conference_bridge_user.features);
 
@@ -787,17 +787,19 @@
 /*! \brief Called when module is being unloaded */
 static int unload_module(void)
 {
+	int res = ast_unregister_application(app);
+	
 	/* Get rid of the conference bridges container. Since we only allow dynamic ones none will be active. */
 	ao2_ref(conference_bridges, -1);
 
-	return ast_unregister_application(app);
+	return res;
 }
 
 /*! \brief Called when module is being loaded */
 static int load_module(void)
 {
 	/* Create a container to hold the conference bridges */
-	if (!(conference_bridges = ao2_container_alloc(MAX_CONFERENCE_BRIDGE_BUCKETS, conference_bridge_hash_cb, conference_bridge_cmp_cb))) {
+	if (!(conference_bridges = ao2_container_alloc(CONFERENCE_BRIDGE_BUCKETS, conference_bridge_hash_cb, conference_bridge_cmp_cb))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
 

Modified: team/file/bridging/bridges/bridge_multiplexed.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/bridges/bridge_multiplexed.c?view=diff&rev=171523&r1=171522&r2=171523
==============================================================================
--- team/file/bridging/bridges/bridge_multiplexed.c (original)
+++ team/file/bridging/bridges/bridge_multiplexed.c Tue Jan 27 06:35:12 2009
@@ -42,8 +42,8 @@
 #include "asterisk/frame.h"
 #include "asterisk/astobj2.h"
 
-/*! \brief Maximum number of buckets our multiplexed thread container can have */
-#define MULTIPLEXED_MAX_BUCKETS 53
+/*! \brief Number of buckets our multiplexed thread container can have */
+#define MULTIPLEXED_BUCKETS 53
 
 /*! \brief Number of channels we handle in a single thread */
 #define MULTIPLEXED_MAX_CHANNELS 8
@@ -303,13 +303,16 @@
 
 static int unload_module(void)
 {
+	int res = ast_bridge_technology_unregister(&multiplexed_bridge);
+	
 	ao2_ref(multiplexed_threads, -1);
-	return ast_bridge_technology_unregister(&multiplexed_bridge);
+
+	return res;
 }
 
 static int load_module(void)
 {
-	if (!(multiplexed_threads = ao2_container_alloc(MULTIPLEXED_MAX_BUCKETS, NULL, NULL))) {
+	if (!(multiplexed_threads = ao2_container_alloc(MULTIPLEXED_BUCKETS, NULL, NULL))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
 




More information about the asterisk-commits mailing list