[asterisk-commits] bebuild: branch certified-13.1 r430008 - in /certified/branches/13.1: ./ res/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 22 12:35:05 CST 2014


Author: bebuild
Date: Mon Dec 22 12:35:00 2014
New Revision: 430008

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430008
Log:
Multiple revisions 429128,429246

........
  r429128 | kmoore | 2014-12-09 08:00:50 -0600 (Tue, 09 Dec 2014) | 12 lines
  
  PJSIP: Stagger outbound qualifies
  
  This change staggers initiation of outbound qualify (OPTIONS) attempts
  to reduce instantaneous server load and prevent network congestion.
  
  Review: https://reviewboard.asterisk.org/r/4246/
  ASTERISK-24342 #close
  Reported by: Richard Mudgett
  ........
  
  Merged revisions 429127 from http://svn.asterisk.org/svn/asterisk/branches/12
........
  r429246 | kmoore | 2014-12-10 07:14:56 -0600 (Wed, 10 Dec 2014) | 8 lines
  
  PJSIP: Fix assert on initial mass qualify
  
  This fixes the MWI test regressions caused by r429127 and ensures that
  contacts have non-zero qualify_frequency before attempting scheduling.
  ........
  
  Merged revisions 429245 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 429128,429246 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    certified/branches/13.1/   (props changed)
    certified/branches/13.1/res/res_pjsip/pjsip_options.c

Propchange: certified/branches/13.1/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Propchange: certified/branches/13.1/
------------------------------------------------------------------------------
--- branch-13-merged (original)
+++ branch-13-merged Mon Dec 22 12:35:00 2014
@@ -1,1 +1,1 @@
-/branches/13:429153,429175,429196,429206,429407,429409,429433,429477,429497,429540,429571,429739,429741,429761,429829
+/branches/13:429128-429222,429224-429246,429407,429409,429433,429477,429497,429540,429571,429739,429741,429761,429829

Modified: certified/branches/13.1/res/res_pjsip/pjsip_options.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/13.1/res/res_pjsip/pjsip_options.c?view=diff&rev=430008&r1=430007&r2=430008
==============================================================================
--- certified/branches/13.1/res/res_pjsip/pjsip_options.c (original)
+++ certified/branches/13.1/res/res_pjsip/pjsip_options.c Mon Dec 22 12:35:00 2014
@@ -418,14 +418,14 @@
 	 * up the data object ref between self deletion and an external
 	 * deletion.
 	 */
-	return 1;
+	return data->contact->qualify_frequency * 1000;
 }
 
 /*!
  * \internal
  * \brief Set up a scheduled qualify contact check.
  */
-static void schedule_qualify(struct ast_sip_contact *contact)
+static void schedule_qualify(struct ast_sip_contact *contact, int initial_interval)
 {
 	struct sched_data *data;
 
@@ -437,8 +437,8 @@
 	ast_assert(contact->qualify_frequency != 0);
 
 	ao2_t_ref(data, +1, "Ref for qualify_contact_sched() scheduler entry");
-	data->id = ast_sched_add_variable(sched, contact->qualify_frequency * 1000,
-		qualify_contact_sched, data, 0);
+	data->id = ast_sched_add_variable(sched, initial_interval,
+		qualify_contact_sched, data, 1);
 	if (data->id < 0) {
 		ao2_t_ref(data, -1, "Cleanup failed scheduler add");
 		ast_log(LOG_ERROR, "Unable to schedule qualify for contact %s\n",
@@ -482,7 +482,7 @@
 			ao2_ref(contact, -1);
 		}
 
-		schedule_qualify(contact);
+		schedule_qualify(contact, contact->qualify_frequency * 1000);
 	} else {
 		delete_contact_status(contact);
 	}
@@ -951,11 +951,18 @@
 {
 	struct ast_sip_contact *contact = obj;
 	struct ast_sip_aor *aor = arg;
+	int initial_interval;
 
 	contact->qualify_frequency = aor->qualify_frequency;
 	contact->authenticate_qualify = aor->authenticate_qualify;
 
-	qualify_and_schedule(contact);
+	/* Delay initial qualification by a random fraction of the specified interval */
+	initial_interval = contact->qualify_frequency * 1000;
+	initial_interval = (int)(initial_interval * ast_random_double());
+
+	if (contact->qualify_frequency) {
+		schedule_qualify(contact, initial_interval);
+	}
 
 	return 0;
 }




More information about the asterisk-commits mailing list