[Freeswitch-svn] [commit] r9574 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Tue Sep 16 16:04:34 EDT 2008


Author: anthm
Date: Tue Sep 16 16:04:33 2008
New Revision: 9574

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c

Log:
omit chat_hash code when presence is not enabled

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Tue Sep 16 16:04:33 2008
@@ -3782,7 +3782,9 @@
 	}
 
 	if (tech_pvt->hash_key) {
+		switch_mutex_lock(tech_pvt->profile->flag_mutex);
 		switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key);
+		switch_mutex_unlock(tech_pvt->profile->flag_mutex);
 	}
 
 	nua_handle_bind(nh, NULL);

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Tue Sep 16 16:04:33 2008
@@ -1231,8 +1231,12 @@
 
 		tech_pvt->chat_from = tech_pvt->from_str;
 		tech_pvt->chat_to = tech_pvt->dest;
-		tech_pvt->hash_key = switch_core_session_strdup(tech_pvt->session, hash_key);
-		switch_core_hash_insert(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt);
+		if (tech_pvt->profile->pflags & PFLAG_PRESENCE) {
+			tech_pvt->hash_key = switch_core_session_strdup(tech_pvt->session, hash_key);
+			switch_mutex_lock(tech_pvt->profile->flag_mutex);
+			switch_core_hash_insert(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt);
+			switch_mutex_unlock(tech_pvt->profile->flag_mutex);
+		}
 		free(e_dest);
 	}
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Tue Sep 16 16:04:33 2008
@@ -1724,10 +1724,11 @@
 	} else {
 		return;
 	}
-
+	
+	switch_mutex_lock(tech_pvt->profile->flag_mutex);
 	tech_pvt->hash_key = switch_core_session_strdup(tech_pvt->session, hash_key);
 	switch_core_hash_insert(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt);
-
+	switch_mutex_unlock(tech_pvt->profile->flag_mutex);
 }
 
 /* For Emacs:



More information about the Freeswitch-svn mailing list