]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3994 --resolve regression from FS-3596:b2d2353c
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 13 Apr 2012 20:58:49 +0000 (15:58 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 13 Apr 2012 20:58:49 +0000 (15:58 -0500)
src/mod/endpoints/mod_sofia/sofia_reg.c

index 7b85161da32366f4570ff083f9366fdda9dc072a..92520719086b3ec96f2ae22e33f2319a9d970ac4 100644 (file)
@@ -127,22 +127,20 @@ static void sofia_reg_kill_sub(sofia_gateway_t *gateway_ptr)
 static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr)
 {
 
-       if (gateway_ptr->nh) {
-               nua_handle_bind(gateway_ptr->nh, NULL);
-       }
-
-       if (gateway_ptr->state != REG_STATE_REGED && gateway_ptr->state != REG_STATE_UNREGISTER) {
-               if (gateway_ptr->nh) {
-                       nua_handle_destroy(gateway_ptr->nh);
-                       gateway_ptr->nh = NULL;
-               }
+       if (!gateway_ptr->nh) {
                return;
        }
 
-       if (gateway_ptr->nh) {
+       if (gateway_ptr->state == REG_STATE_REGED || gateway_ptr->state == REG_STATE_UNREGISTER) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UN-Registering %s\n", gateway_ptr->name);
                nua_unregister(gateway_ptr->nh, NUTAG_URL(gateway_ptr->register_url), NUTAG_REGISTRAR(gateway_ptr->register_proxy), TAG_END());
+       } else {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Destroying registration handle for %s\n", gateway_ptr->name);
        }
+
+       nua_handle_bind(gateway_ptr->nh, NULL);
+       nua_handle_destroy(gateway_ptr->nh);
+       gateway_ptr->nh = NULL;
 }
 
 void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase)