]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
omit chat_hash code when presence is not enabled
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 16 Sep 2008 20:04:33 +0000 (20:04 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 16 Sep 2008 20:04:33 +0000 (20:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9574 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index 47cf0eb016f03335fc9b5480c24074d2e4c8babd..2d7366808346f6968e7555204c6ee4588a421f5c 100644 (file)
@@ -3782,7 +3782,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
        }
 
        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);
index 555ed742ec61900310c1dee5185061774fe25c6c..d1e104dd1b5866d4f7eeecb86f31009680d7cf02 100644 (file)
@@ -1231,8 +1231,12 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
 
                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);
        }
 
index cfbd64a393c33f50127aeb3a38872edc1e126b64..bf7bc8d10d429d15481fb640372c6d8b537406ef 100644 (file)
@@ -1724,10 +1724,11 @@ void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip)
        } 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: