[asterisk-commits] oej: trunk r68026 - in /trunk: ./ include/asterisk/jabber.h res/res_jabber.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 7 02:21:29 MST 2007


Author: oej
Date: Thu Jun  7 04:21:29 2007
New Revision: 68026

URL: http://svn.digium.com/view/asterisk?view=rev&rev=68026
Log:
Merged revisions 67993 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r67993 | oej | 2007-06-07 11:00:44 +0200 (Thu, 07 Jun 2007) | 6 lines

Issue #9738 - Make sure we can unload res_jabber. Patch by phsultan - thanks!

Due to a bug in the iksemel library, this will not work if you are using GTLS
in the connection. That's being investigated. If you figure out a way to handle
that without us having to patch iksemel, let us know in the bug report. Thanks.

........

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/jabber.h
    trunk/res/res_jabber.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/asterisk/jabber.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/jabber.h?view=diff&rev=68026&r1=68025&r2=68026
==============================================================================
--- trunk/include/asterisk/jabber.h (original)
+++ trunk/include/asterisk/jabber.h Thu Jun  7 04:21:29 2007
@@ -50,7 +50,8 @@
 #include "asterisk/linkedlists.h"
 
 enum aji_state {
-	AJI_DISCONNECTED = 0,
+	AJI_DISCONNECTING,
+	AJI_DISCONNECTED,
 	AJI_CONNECTING,
 	AJI_CONNECTED
 };

Modified: trunk/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_jabber.c?view=diff&rev=68026&r1=68025&r2=68026
==============================================================================
--- trunk/res/res_jabber.c (original)
+++ trunk/res/res_jabber.c Thu Jun  7 04:21:29 2007
@@ -469,7 +469,9 @@
 
 /*!
  * \brief The action hook parses the inbound packets, constantly running.
- * \param aji client structure, type of packet, the actual packet.
+ * \param data aji client structure 
+ * \param type type of packet 
+ * \param node the actual packet.
  * \return IKS_OK or IKS_HOOK .
  */
 static int aji_act_hook(void *data, int type, iks *node)
@@ -480,6 +482,11 @@
 
 	if(!node) {
 		ast_log(LOG_ERROR, "aji_act_hook was called with out a packet\n"); /* most likely cause type is IKS_NODE_ERROR lost connection */
+		ASTOBJ_UNREF(client, aji_client_destroy);
+		return IKS_HOOK;
+	}
+
+	if (client->state == AJI_DISCONNECTING) {
 		ASTOBJ_UNREF(client, aji_client_destroy);
 		return IKS_HOOK;
 	}
@@ -1511,6 +1518,12 @@
 		}
 
 		res = iks_recv(client->p, 1);
+
+		if (client->state == AJI_DISCONNECTING) {
+			if (option_debug > 1)
+				ast_log(LOG_DEBUG, "Ending our Jabber client's thread due to a disconnect\n");
+			pthread_exit(NULL);
+		}
 		client->timeout--;
 		if (res == IKS_HOOK) 
 			ast_log(LOG_WARNING, "JABBER: Got hook event.\n");
@@ -2380,9 +2393,9 @@
 	ast_manager_unregister("JabberSend");
 	ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, {
 		ASTOBJ_RDLOCK(iterator);
-		if (option_verbose > 2)
-			ast_verbose(VERBOSE_PREFIX_3 "JABBER: %s\n", iterator->name);
-		iterator->state = AJI_DISCONNECTED;
+		if (option_debug > 2)
+			ast_log(LOG_DEBUG, "JABBER: Releasing and disconneing client: %s\n", iterator->name);
+		iterator->state = AJI_DISCONNECTING;
 		ast_aji_disconnect(iterator);
 		pthread_join(iterator->thread, NULL);
 		ASTOBJ_UNLOCK(iterator);
@@ -2390,8 +2403,6 @@
 
 	ASTOBJ_CONTAINER_DESTROYALL(&clients, aji_client_destroy);
 	ASTOBJ_CONTAINER_DESTROY(&clients);
-
-	ast_log(LOG_NOTICE, "res_jabber unloaded.\n");
 	return 0;
 }
 
@@ -2406,7 +2417,6 @@
 	ast_register_application(app_ajistatus, aji_status_exec, ajistatus_synopsis, ajistatus_descrip);
 	ast_cli_register_multiple(aji_cli, sizeof(aji_cli) / sizeof(struct ast_cli_entry));
 
-	ast_log(LOG_NOTICE, "res_jabber.so loaded.\n");
 	return 0;
 }
 



More information about the asterisk-commits mailing list