[Freeswitch-svn] [commit] r2327 - in freeswitch/trunk: libs/libdingaling/src src/mod/endpoints/mod_dingaling

Freeswitch SVN anthm at freeswitch.org
Fri Aug 18 14:44:12 EDT 2006


Author: anthm
Date: Fri Aug 18 14:44:11 2006
New Revision: 2327

Modified:
   freeswitch/trunk/libs/libdingaling/src/libdingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c

Log:
last round of google cleanup rebuild libdingaling

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c	Fri Aug 18 14:44:11 2006
@@ -201,16 +201,20 @@
 
 	if (session) {
 		apr_pool_t *pool = session->pool;
+		apr_hash_t *hash = session->handle->sessions;
 
 		if (globals.debug) {
 			globals.logger(DL_LOG_DEBUG, "Destroyed Session %s\n", session->id);
 		}
+
 		if (session->id) {
-			apr_hash_set(session->handle->sessions, session->id, APR_HASH_KEY_STRING, NULL);
+			apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL);
 		}
+
 		if (session->them) {
-			apr_hash_set(session->handle->sessions, session->them, APR_HASH_KEY_STRING, NULL);
+			apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL);
 		}
+
 		apr_pool_destroy(pool);
 		pool = NULL;
 		*session_p = NULL;
@@ -501,6 +505,8 @@
 	char *iqid = iks_find_attrib(pak->x, "id");
 	char *type = iks_find_attrib(pak->x, "type");
 	uint8_t is_result = strcasecmp(type, "result") ? 0 : 1;
+	uint8_t is_error = strcasecmp(type, "error") ? 0 : 1;
+
 	iks *xml;
 
 	if (is_result) {
@@ -550,18 +556,18 @@
 		}
 	}
 
-	if ((is_result || !strcasecmp(type, "error")) && iqid && from) {
+	if ((is_result || is_error) && iqid && from) {
+
 		cancel_retry(handle, iqid);
 		if (is_result) {
 			if (handle->response_callback) {
 				handle->response_callback(handle, iqid); 
 			}
 			return IKS_FILTER_EAT;
+		} else if (is_error) {
+			return IKS_FILTER_EAT;
 		}
 	}
-
-
-
 	
 	xml = iks_child (pak->x);
 	while (xml) {

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Fri Aug 18 14:44:11 2006
@@ -65,7 +65,8 @@
 	TFLAG_LANADDR = (1 << 16),
 	TFLAG_AUTO = (1 << 17),
 	TFLAG_DTMF = (1 << 18),
-	TFLAG_TIMER = ( 1 << 19)
+	TFLAG_TIMER = ( 1 << 19),
+	TFLAG_TERM = ( 1 << 20)
 } TFLAGS;
 
 typedef enum {
@@ -185,7 +186,10 @@
 		assert(tech_pvt != NULL);
 
 		if (tech_pvt->dlsession) {
-			ldl_session_terminate(tech_pvt->dlsession);
+			if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+				ldl_session_terminate(tech_pvt->dlsession);
+				switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+			}
 			ldl_session_destroy(&tech_pvt->dlsession);
 		}
 
@@ -682,7 +686,10 @@
 	switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 	
 	if (tech_pvt->dlsession) {
-		ldl_session_terminate(tech_pvt->dlsession);
+		if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+			ldl_session_terminate(tech_pvt->dlsession);
+			switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+		}
 		ldl_session_destroy(&tech_pvt->dlsession);
 	}
 
@@ -717,7 +724,10 @@
 			switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 
 			if (tech_pvt->dlsession) {
-				ldl_session_terminate(tech_pvt->dlsession);
+				if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+					ldl_session_terminate(tech_pvt->dlsession);
+					switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+				}
 				ldl_session_destroy(&tech_pvt->dlsession);
 
 			}
@@ -1840,6 +1850,7 @@
 			switch_channel_state_t state = switch_channel_get_state(channel);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hungup %s %u %d\n", switch_channel_get_name(channel), state, CS_INIT);
 			switch_mutex_lock(tech_pvt->flag_mutex);
+			switch_set_flag(tech_pvt, TFLAG_TERM);
 			switch_set_flag(tech_pvt, TFLAG_BYE);
 			switch_clear_flag(tech_pvt, TFLAG_IO);
 			switch_mutex_unlock(tech_pvt->flag_mutex);



More information about the Freeswitch-svn mailing list