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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 16 08:43:43 CDT 2008


Author: snuffy
Date: Tue Sep 16 08:43:42 2008
New Revision: 143203

URL: http://svn.digium.com/view/asterisk?view=rev&rev=143203
Log:
Let the ref counting begin in earnest!

Modified:
    team/snuffy/ao2_jabber/channels/chan_gtalk.c
    team/snuffy/ao2_jabber/channels/chan_jingle.c
    team/snuffy/ao2_jabber/include/asterisk/jabber.h
    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=143203&r1=143202&r2=143203
==============================================================================
--- team/snuffy/ao2_jabber/channels/chan_gtalk.c (original)
+++ team/snuffy/ao2_jabber/channels/chan_gtalk.c Tue Sep 16 08:43:42 2008
@@ -63,9 +63,9 @@
 #include "asterisk/utils.h"
 #include "asterisk/causes.h"
 #include "asterisk/astobj.h"
-#include "asterisk/astobj2.h"
 #include "asterisk/abstract_jb.h"
 #include "asterisk/jabber.h"
+#include "asterisk/astobj2.h"
 
 #define GOOGLE_CONFIG "gtalk.conf"
 

Modified: team/snuffy/ao2_jabber/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/snuffy/ao2_jabber/channels/chan_jingle.c?view=diff&rev=143203&r1=143202&r2=143203
==============================================================================
--- team/snuffy/ao2_jabber/channels/chan_jingle.c (original)
+++ team/snuffy/ao2_jabber/channels/chan_jingle.c Tue Sep 16 08:43:42 2008
@@ -65,10 +65,10 @@
 #include "asterisk/utils.h"
 #include "asterisk/causes.h"
 #include "asterisk/astobj.h"
-#include "asterisk/astobj2.h"
 #include "asterisk/abstract_jb.h"
 #include "asterisk/jabber.h"
 #include "asterisk/jingle.h"
+#include "asterisk/astobj2.h"
 
 #define JINGLE_CONFIG "jingle.conf"
 

Modified: team/snuffy/ao2_jabber/include/asterisk/jabber.h
URL: http://svn.digium.com/view/asterisk/team/snuffy/ao2_jabber/include/asterisk/jabber.h?view=diff&rev=143203&r1=143202&r2=143203
==============================================================================
--- team/snuffy/ao2_jabber/include/asterisk/jabber.h (original)
+++ team/snuffy/ao2_jabber/include/asterisk/jabber.h Tue Sep 16 08:43:42 2008
@@ -57,9 +57,10 @@
 #define IKS_NET_EXPIRED 12
 
 #include <iksemel.h>
+#define REF_DEBUG 1
 #include "asterisk/astobj.h"
+#include "asterisk/astobj2.h"
 #include "asterisk/linkedlists.h"
-
 /* 
  * As per RFC 3920 - section 3.1, the maximum length for a full Jabber ID 
  * is 3071 bytes.

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=143203&r1=143202&r2=143203
==============================================================================
--- team/snuffy/ao2_jabber/res/res_jabber.c (original)
+++ team/snuffy/ao2_jabber/res/res_jabber.c Tue Sep 16 08:43:42 2008
@@ -168,6 +168,51 @@
 /*! \brief Global flags, initialized to default values */
 static struct ast_flags globalflags = { AJI_AUTOPRUNE | AJI_AUTOREGISTER };
 
+#ifdef REF_DEBUG
+#define client_ref(arg1,arg2) client_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define client_unref(arg1,arg2) client_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define buddy_ref(arg1,arg2) buddy_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define buddy_unref(arg1,arg2) buddy_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+static struct aji_buddy *buddy_ref_debug(struct aji_buddy *b, char *tag, char *file, int line, const char *func)
+{
+	if (b) {
+		_ao2_ref_debug(b, 1, tag, file, line,func);
+	} else {
+		ast_log(LOG_ERROR, "Attempt to ref a NULL pointer\n");
+	}
+
+	return b;
+}
+
+static void buddy_unref_debug(struct aji_buddy *b, char *tag, char *file, int line, const char *func)
+{
+	if (b) {
+		_ao2_ref_debug(b, -1, tag, file, line, func);
+	} else {
+		ast_log(LOG_ERROR, "Attempt to unref a NULL pointer\n");
+	}
+}
+
+static struct aji_client *client_ref_debug(struct aji_client *c, char *tag, char *file, int line, const char *func)
+{
+	if (c) {
+		_ao2_ref_debug(c, 1, tag, file, line, func);
+	} else {
+		ast_log(LOG_ERROR, "Attempt to ref a NULL pointer\n");
+	}
+
+	return c;
+}
+
+static void client_unref_debug(struct aji_client *c, char *tag, char *file, int line, const char *func)
+{
+	if (c) {
+		_ao2_ref_debug(c, -1, tag, file, line, func);
+	} else {
+		ast_log(LOG_ERROR, "Attempt to unref a NULL pointer\n");
+	}
+}
+#else
 static struct aji_buddy *buddy_ref(struct aji_buddy *b, char *tag)
 {
 	if (b) {
@@ -207,6 +252,7 @@
 		ast_log(LOG_ERROR, "Attempt to unref a NULL pointer\n");
 	}
 }
+#endif
 
 static int client_cmp_cb(void *obj, void *arg, int flags)
 {
@@ -1012,6 +1058,7 @@
 #ifdef HAVE_OPENSSL
 			if (client->stream_flags & TRY_SECURE) {
 				if (!strcmp("proceed", iks_name(node))) {
+					client_unref(client,"try_sec");
 					return aji_tls_handshake(client);
 				}
 			}
@@ -3181,11 +3228,13 @@
 		astman_append(s, "Response: Success\r\n");
 		if (!ast_strlen_zero(id))
 			astman_append(s, "ActionID: %s\r\n",id);
+		client_unref(client,"manager send");
 		return 0;
 	}
 	astman_append(s, "Response: Error\r\n");
 	if (!ast_strlen_zero(id))
 		astman_append(s, "ActionID: %s\r\n",id);
+	client_unref(client,"manager send");
 	return 0;
 }
 




More information about the asterisk-commits mailing list