]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
do not retry so fast on failed outbound subs
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 14 Mar 2014 17:55:50 +0000 (12:55 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 14 Mar 2014 17:56:01 +0000 (12:56 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index 1e64bc981ca5195dad412caf6c8bacadc4b9525d..c174f60420b848b7343bd812c9483ce6be5b19fb 100644 (file)
@@ -461,6 +461,7 @@ typedef enum {
        SUB_STATE_SUBED,
        SUB_STATE_UNSUBSCRIBE,
        SUB_STATE_FAILED,
+       SUB_STATE_FAIL_WAIT,
        SUB_STATE_EXPIRED,
        SUB_STATE_NOSUB,
        v_STATE_LAST
index f62fc88325a18e6bd4859fb6c9e5551ff50f4fed..2d94d1b7e3fa4e671d23af07ea7a04cb7b89fcfd 100644 (file)
@@ -4245,8 +4245,6 @@ void sofia_presence_handle_sip_r_subscribe(int status,
        default:
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "status (%d) != 200, updated state to SUB_STATE_FAILED.\n", status);
                gw_sub_ptr->state = SUB_STATE_FAILED;
-               gw_sub_ptr->expires = switch_epoch_time_now(NULL);
-               gw_sub_ptr->retry = switch_epoch_time_now(NULL);
 
                if (!sofia_private) {
                        nua_handle_destroy(nh);
index 336814d351d9da7dff7d2bd08dff2ef459114e47..2c1f0f8389b6006b1cc0f087da6210ddd7f9bda7 100644 (file)
@@ -253,6 +253,15 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
                                break;
 
                        case SUB_STATE_FAILED:
+                               gw_sub_ptr->expires = now;
+                               gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds;
+                               gw_sub_ptr->state = SUB_STATE_FAIL_WAIT;
+                               break;
+                       case SUB_STATE_FAIL_WAIT:
+                               if (!gw_sub_ptr->retry || now >= gw_sub_ptr->retry) {
+                                       gw_sub_ptr->state = SUB_STATE_UNSUBED;
+                               }
+                               break;
                        case SUB_STATE_TRYING:
                                if (gw_sub_ptr->retry && now >= gw_sub_ptr->retry) {
                                        gw_sub_ptr->state = SUB_STATE_UNSUBED;