[asterisk-commits] kmoore: branch kmoore/bridge_construction-cel_bridging r389477 - /team/kmoore...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 22 08:06:02 CDT 2013


Author: kmoore
Date: Wed May 22 08:05:59 2013
New Revision: 389477

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389477
Log:
Clear cached data for bridges that go away

Modified:
    team/kmoore/bridge_construction-cel_bridging/main/cel.c

Modified: team/kmoore/bridge_construction-cel_bridging/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_bridging/main/cel.c?view=diff&rev=389477&r1=389476&r2=389477
==============================================================================
--- team/kmoore/bridge_construction-cel_bridging/main/cel.c (original)
+++ team/kmoore/bridge_construction-cel_bridging/main/cel.c Wed May 22 08:05:59 2013
@@ -733,7 +733,6 @@
 {
 	RAII_VAR(struct ast_channel_snapshot *, snapshot, ast_channel_snapshot_get_latest(channel_id), ao2_cleanup);
 	if (!snapshot) {
-		ast_log(LOG_ERROR, "COULDN'T FIND SNAPSHOT RAAAA\n");
 		return -1;
 	}
 	return report_event_snapshot(snapshot, event_type, userdefevname, extra, peer2_id);
@@ -1199,6 +1198,22 @@
 	assoc->primary_snapshot = snapshot;
 }
 
+static int bridge_match_cb(void *obj, void *arg, int flags)
+{
+	struct bridge_assoc *assoc = obj;
+	char *bridge_id = arg;
+	if (!strcmp(bridge_id, assoc->bridge_id)) {
+		return CMP_MATCH;
+	}
+	return 0;
+}
+
+static void clear_bridge_primary(const char *bridge_id)
+{
+	char *dup_id = ast_strdupa(bridge_id);
+	ao2_callback(bridge_primaries, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, bridge_match_cb, dup_id);
+}
+
 static void cel_snapshot_update_cb(void *data, struct stasis_subscription *sub,
 	struct stasis_topic *topic,
 	struct stasis_message *message)
@@ -1225,6 +1240,15 @@
 
 		old_snapshot = stasis_message_data(update->old_snapshot);
 		new_snapshot = stasis_message_data(update->new_snapshot);
+
+		if (!old_snapshot) {
+			return;
+		}
+
+		if (!new_snapshot) {
+			clear_bridge_primary(old_snapshot->uniqueid);
+			return;
+		}
 
 		if (old_snapshot->capabilities == new_snapshot->capabilities) {
 			return;




More information about the asterisk-commits mailing list