]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ok, patch applied cleanly
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 25 Mar 2010 00:28:56 +0000 (00:28 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 25 Mar 2010 00:28:56 +0000 (00:28 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17096 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index bead4d3fb8d33651b1b900e6efcfe4b4e767f80e..9d10bbdd300b4d8d23c4de545e9883d5e45c2b18 100644 (file)
@@ -842,7 +842,7 @@ sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, i
 #define sofia_glue_profile_rdlock(x) sofia_glue_profile_rdlock__(__FILE__, __SWITCH_FUNC__, __LINE__, x)
 switch_status_t sofia_glue_profile_rdlock__(const char *file, const char *func, int line, sofia_profile_t *profile);
 
-switch_status_t sofia_reg_add_gateway(const char *profile_name, const char *key, sofia_gateway_t *gateway);
+switch_status_t sofia_reg_add_gateway(sofia_profile_t *profile, const char *key, sofia_gateway_t *gateway);
 sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, const char *key);
 #define sofia_reg_find_gateway(x) sofia_reg_find_gateway__(__FILE__, __SWITCH_FUNC__, __LINE__,  x)
 
index 528c31db1239ca1725a27e137c2f4250c36abf6c..df3da21156bdb645d959df00bf6141e15b70f342 100644 (file)
@@ -2023,9 +2023,9 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                gateway->freq = 3600;
                        }
 
-                       gateway->next = profile->gateways;
-                       profile->gateways = gateway;
-                       sofia_reg_add_gateway(profile->name, gateway->name, gateway);
+
+                       sofia_reg_add_gateway(profile, gateway->name, gateway);
+                       
                }
 
          skip:
index baa605a06c7a0a121612b9f0720f04bcd62bf715..22c5377ea5ec1a3aa4817e2ea294392e40f1b81b 100644 (file)
@@ -4529,6 +4529,10 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
                        "create index ssd_contact_str on sip_shared_appearance_dialogs (contact_str)",
                        "create index ssd_call_id on sip_shared_appearance_dialogs (call_id)",
                        "create index ssd_expires on sip_shared_appearance_dialogs (expires)",
+                       "create index sr_1 on sip_recovery (runtime_uuid)",
+                       "create index sr_2 on sip_recovery (profile_name)",
+                       "create index sr_3 on sip_recovery (hostname)",
+                       "create index sr_4 on sip_recovery (uuid)",
                        NULL
                };
 
@@ -4747,6 +4751,12 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
 
                switch_core_db_exec(db, "create index if not exists sa_nonce on sip_authentication (nonce)", NULL, NULL, NULL);
                switch_core_db_exec(db, "create index if not exists sa_hostname on sip_authentication (hostname)", NULL, NULL, NULL);
+
+               switch_core_db_exec(db, "create index if not exists sr_1 on sip_recovery (runtime_uuid)", NULL, NULL, NULL);
+               switch_core_db_exec(db, "create index if not exists sr_2 on sip_recovery (profile_name)", NULL, NULL, NULL);
+               switch_core_db_exec(db, "create index if not exists sr_3 on sip_recovery (hostname)", NULL, NULL, NULL);
+               switch_core_db_exec(db, "create index if not exists sr_4 on sip_recovery (uuid)", NULL, NULL, NULL);
+               
        }
 
        if (odbc_dbh) {
index d9bfb0627bb7bc8c436adade72abf9cdea0dbaa3..2f903d14b40370e830abf7e3a589260601a2bc51 100644 (file)
@@ -109,6 +109,7 @@ static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway,
 void sofia_reg_unregister(sofia_profile_t *profile)
 {
        sofia_gateway_t *gateway_ptr;
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
        for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
 
                if (gateway_ptr->sofia_private) {
@@ -120,6 +121,7 @@ void sofia_reg_unregister(sofia_profile_t *profile)
                }
 
        }
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }
 
 void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
@@ -131,6 +133,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
         */
        sofia_gateway_t *gateway_ptr;
 
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
        for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
                sofia_gateway_subscription_t *gw_sub_ptr;
 
@@ -217,6 +220,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
                        switch_safe_free(user_via);
                }
        }
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }
 
 void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
@@ -225,6 +229,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
        switch_event_t *event;
        char *pkey;
 
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
        for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
                if (gateway_ptr->deleted && gateway_ptr->state == REG_STATE_NOREG) {
                        if (last) {
@@ -403,6 +408,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
                        sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL);
                }
        }
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }
 
 
@@ -2419,15 +2425,20 @@ void sofia_reg_release_gateway__(const char *file, const char *func, int line, s
 #endif
 }
 
-switch_status_t sofia_reg_add_gateway(const char *profile_name, const char *key, sofia_gateway_t *gateway)
+switch_status_t sofia_reg_add_gateway(sofia_profile_t *profile, const char *key, sofia_gateway_t *gateway)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;
-       char *pkey = switch_mprintf("%s::%s", profile_name, key);
+       char *pkey = switch_mprintf("%s::%s", profile->name, key);
 
        switch_mutex_lock(mod_sofia_globals.hash_mutex);
+
+       gateway->next = profile->gateways;
+       profile->gateways = gateway;
+       
        if (!switch_core_hash_find(mod_sofia_globals.gateway_hash, key)) {
                status = switch_core_hash_insert(mod_sofia_globals.gateway_hash, key, gateway);
        }
+
        if (!switch_core_hash_find(mod_sofia_globals.gateway_hash, pkey)) {
                status = switch_core_hash_insert(mod_sofia_globals.gateway_hash, pkey, gateway);
        }