]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix restart
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Nov 2007 03:16:28 +0000 (03:16 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Nov 2007 03:16:28 +0000 (03:16 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6184 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index a4e13c7594fdb631df8ba3b85d9150b2403462b8..1435b2ad13f392ec63219323bb55f1e2aacf97b0 100644 (file)
@@ -457,7 +457,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
        su_root_run(profile->s_root);
        nua_destroy(profile->nua);
 
-
+       switch_mutex_lock(profile->ireg_mutex);
+       switch_mutex_unlock(profile->ireg_mutex);
 
        if (switch_event_create(&s_event, SWITCH_EVENT_UNPUBLISH) == SWITCH_STATUS_SUCCESS) {
                switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "service", "_sip._udp,_sip._tcp,_sip._sctp");
index 0eebffc14672e52a828c8946f2b1a3457d67e1e8..6e1579fb92ded5f86f0248dccc12702cad6f6856 100644 (file)
@@ -1658,9 +1658,27 @@ switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile)
 void sofia_glue_del_profile(sofia_profile_t *profile)
 {
        sofia_gateway_t *gp;
-
+       char *aliases[512];
+       int i = 0, j = 0;
+       switch_hash_index_t *hi;
+       const void *var;
+       void *val;
+       
        switch_mutex_lock(mod_sofia_globals.hash_mutex);
-       switch_core_hash_delete(mod_sofia_globals.profile_hash, profile->name);
+
+       for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+               switch_hash_this(hi, &var, NULL, &val);
+               aliases[i++] = strdup((char *) var);
+               if (i == 512) {
+                       abort();
+               }
+       }
+
+       for (j = 0; j < i && j < 512; j++) {
+               switch_core_hash_delete(mod_sofia_globals.profile_hash, aliases[j]);
+               free(aliases[j]);
+       }
+
        for (gp = profile->gateways; gp; gp = gp->next) {
                switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->name);
        }