[svn-commits] mjordan: branch 11 r434564 - /branches/11/channels/chan_iax2.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Apr 10 07:35:53 CDT 2015


Author: mjordan
Date: Fri Apr 10 07:35:49 2015
New Revision: 434564

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434564
Log:
channels/chan_iax2: Improve POKE expiration time calculation for lossy networks

POKE is used to check for peer availability; however, in networks with packet
loss, the current calculations may result in POKE expiration times that are too
short. This patch alters the expiration/retry time logic to take into account
the last known qualify round trip time, as opposed to always using a static
value for each peer.

Review: https://reviewboard.asterisk.org/r/4536

ASTERISK-24894 #close
Reported by: Y Ateya
patches:
  poke_noanswer_duration.diff submitted by Y Ateya (License 6693)

Modified:
    branches/11/channels/chan_iax2.c

Modified: branches/11/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_iax2.c?view=diff&rev=434564&r1=434563&r2=434564
==============================================================================
--- branches/11/channels/chan_iax2.c (original)
+++ branches/11/channels/chan_iax2.c Fri Apr 10 07:35:49 2015
@@ -12421,6 +12421,7 @@
 static int iax2_poke_peer(struct iax2_peer *peer, int heldcall)
 {
 	int callno;
+	int poke_timeout;
 	struct sockaddr_in peer_addr;
 
 	if (!peer->maxms || (!ast_sockaddr_ipv4(&peer->addr) && !peer->dnsmgr)) {
@@ -12459,12 +12460,24 @@
 		}
 	}
 
+	if (peer->lastms < 0){
+		/* If the host is already unreachable then use time less than the unreachable
+		 * interval. 5/6 is arbitrary multiplier to get value less than
+		 * peer->pokefreqnotok. Value less than peer->pokefreqnotok is used to expire
+		 * current POKE before starting new POKE (which is scheduled after
+		 * peer->pokefreqnotok). */
+		poke_timeout = peer->pokefreqnotok * 5  / 6;
+	} else {
+		/* If the host is reachable, use timeout large enough to allow for multiple
+		 * POKE retries. Limit this value to less than peer->pokefreqok. 5/6 is arbitrary
+		 * multiplier to get value less than peer->pokefreqok. Value less than
+		 * peer->pokefreqok is used to expire current POKE before starting new POKE
+		 * (which is scheduled after peer->pokefreqok). */
+		poke_timeout = MIN(MAX_RETRY_TIME * 2 + peer->maxms, peer->pokefreqok * 5  / 6);
+	}
+
 	/* Queue up a new task to handle no reply */
-	/* If the host is already unreachable then use the unreachable interval instead */
-	if (peer->lastms < 0)
-		peer->pokeexpire = iax2_sched_add(sched, peer->pokefreqnotok, iax2_poke_noanswer, peer_ref(peer));
-	else
-		peer->pokeexpire = iax2_sched_add(sched, DEFAULT_MAXMS * 2, iax2_poke_noanswer, peer_ref(peer));
+	peer->pokeexpire = iax2_sched_add(sched, poke_timeout, iax2_poke_noanswer, peer_ref(peer));
 
 	if (peer->pokeexpire == -1)
 		peer_unref(peer);
@@ -12478,7 +12491,7 @@
 		};
 
 		/* Speed up retransmission times for this qualify call */
-		iaxs[callno]->pingtime = peer->maxms / 4 + 1;
+		iaxs[callno]->pingtime = peer->maxms / 8;
 		iaxs[callno]->peerpoke = peer;
 
 		add_empty_calltoken_ie(iaxs[callno], &ied); /* this _MUST_ be the last ie added */




More information about the svn-commits mailing list