[asterisk-commits] snuffy: branch snuffy/ao2_jabber_take2 r173857 - /team/snuffy/ao2_jabber_take...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 6 04:48:44 CST 2009


Author: snuffy
Date: Fri Feb  6 04:48:44 2009
New Revision: 173857

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=173857
Log:
Update with another callback.. almost ready for more testing

Modified:
    team/snuffy/ao2_jabber_take2/res/res_jabber.c

Modified: team/snuffy/ao2_jabber_take2/res/res_jabber.c
URL: http://svn.digium.com/svn-view/asterisk/team/snuffy/ao2_jabber_take2/res/res_jabber.c?view=diff&rev=173857&r1=173856&r2=173857
==============================================================================
--- team/snuffy/ao2_jabber_take2/res/res_jabber.c (original)
+++ team/snuffy/ao2_jabber_take2/res/res_jabber.c Fri Feb  6 04:48:44 2009
@@ -367,6 +367,15 @@
 	return ast_str_case_hash(client->name);
 }
 
+static int aji_buddy_mark_cb(void *data, void *args, int flags) {
+	struct aji_buddy *b = data;
+
+	ao2_lock(b);
+	b->mark = 1;
+	ao2_unlock(b);
+
+	return 0;
+}
 /*!
  * \brief Deletes the aji_client data structure.
  * \param obj aji_client The structure we will delete.
@@ -2867,8 +2876,6 @@
 	char *resource;
 	struct aji_client *client = NULL;
 	struct aji_client tmp_client;
-	struct aji_buddy *buddy = NULL;
-	struct ao2_iterator biter;
 	int flag = 0;
 
 	ast_copy_string(tmp_client.name, label, sizeof(tmp_client.name));
@@ -2884,19 +2891,20 @@
 		client->buddies = ao2_t_container_alloc(hash_buddy_size, buddy_hash_cb, buddy_cmp_cb, "allocate buddies");
 	} else {
 		ao2_lock(client);
-		client->mark = 1;
-
-		/*ASTOBJ_UNMARK(client);*/
+		client->mark = 0;
 	}
 	/*ASTOBJ_CONTAINER_MARKALL(&client->buddies); */
-	biter = ao2_iterator_init(client->buddies, 0);
+	
+	ao2_t_callback(client->buddies, 0, aji_buddy_mark_cb, NULL, NULL);
+
+/*	biter = ao2_iterator_init(client->buddies, 0);
 	while (( buddy = ao2_t_iterator_next(&biter, "Iter buddies"))) {
 		ao2_lock(b);
 		buddy->mark = 1;
 		ao2_unlock(buddy);
 		buddy_unref(buddy, "unref buddy");
 	}
-
+*/
 
 	ast_copy_string(client->name, label, sizeof(client->name));
 	ast_copy_string(client->mid, "aaaaa", sizeof(client->mid));
@@ -3134,7 +3142,6 @@
 	if(flag)
 		ao2_t_link(client->buddies, buddy, "link buddy");
 	else {
-		/*ASTOBJ_UNMARK(buddy);*/
 		buddy->mark = 0;
 	}
 	ao2_unlock(buddy);




More information about the asterisk-commits mailing list