[asterisk-commits] snuffy: branch snuffy/ao2_jabber r145018 - in /team/snuffy/ao2_jabber: channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 27 20:17:18 CDT 2008


Author: snuffy
Date: Sat Sep 27 20:17:18 2008
New Revision: 145018

URL: http://svn.digium.com/view/asterisk?view=rev&rev=145018
Log:
Marching ever closer.. ref counts beware.. i'm coming for you

Modified:
    team/snuffy/ao2_jabber/channels/chan_gtalk.c
    team/snuffy/ao2_jabber/res/res_jabber.c

Modified: team/snuffy/ao2_jabber/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/snuffy/ao2_jabber/channels/chan_gtalk.c?view=diff&rev=145018&r1=145017&r2=145018
==============================================================================
--- team/snuffy/ao2_jabber/channels/chan_gtalk.c (original)
+++ team/snuffy/ao2_jabber/channels/chan_gtalk.c Sat Sep 27 20:17:18 2008
@@ -236,7 +236,8 @@
 static void gtalk_member_destroy(struct gtalk *obj)
 {
 	//ao2_t_ref(obj->connection->buddies, -1, "die ref");
-	ao2_t_ref(obj->connection, -1, "die ref");
+	ao2_t_ref(obj->connection, -1, "die client ref");
+	ao2_t_ref(obj->buddy, -1, "die buddy ref");
 	ast_free(obj);
 }
 

Modified: team/snuffy/ao2_jabber/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/snuffy/ao2_jabber/res/res_jabber.c?view=diff&rev=145018&r1=145017&r2=145018
==============================================================================
--- team/snuffy/ao2_jabber/res/res_jabber.c (original)
+++ team/snuffy/ao2_jabber/res/res_jabber.c Sat Sep 27 20:17:18 2008
@@ -3308,8 +3308,9 @@
 /*! \brief Unload the jabber module */
 static int unload_module(void)
 {
-	struct ao2_iterator iter;
+	struct ao2_iterator citer, biter;
 	struct aji_client *c = NULL;
+	struct aji_buddy *b = NULL;
 
 	ast_cli_unregister_multiple(aji_cli, sizeof(aji_cli) / sizeof(struct ast_cli_entry));
 	ast_unregister_application(app_ajisend);
@@ -3317,10 +3318,15 @@
 	ast_manager_unregister("JabberSend");
 	ast_custom_function_unregister(&jabberstatus_function);
 	
-	iter = ao2_iterator_init(clients, 0);
-	while ((c = ao2_t_iterator_next(&iter, "iterate through clients"))) {
+	citer = ao2_iterator_init(clients, 0);
+	while ((c = ao2_t_iterator_next(&citer, "iterate through clients"))) {
 		ao2_lock(c);
 		ast_debug(3, "JABBER: Releasing and disconnecting client: %s\n", c->name);
+		biter = ao2_iterator_init(c->buddies, 0);
+		while((b = ao2_t_iterator_next(&biter,"iterate through buddies"))) {
+			ao2_t_unlink(c->buddies, b, "unlink buddy");
+			buddy_unref(b, "unref buddy");
+		}
 		c->state = AJI_DISCONNECTING;
 		ast_aji_disconnect(c);
 		pthread_join(c->thread, NULL);




More information about the asterisk-commits mailing list