[asterisk-commits] russell: trunk r77269 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 26 08:26:45 CDT 2007


Author: russell
Date: Thu Jul 26 08:26:44 2007
New Revision: 77269

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77269
Log:
Revert some changes to call abs() on the result of ast_random().
 * random() is defined to return a positive result, and now ast_random()
   will always do so as well

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=77269&r1=77268&r2=77269
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jul 26 08:26:44 2007
@@ -6755,7 +6755,7 @@
 	}
 	
 	if (!p->sessionid) {
-		p->sessionid = (int)abs(ast_random());
+		p->sessionid = (int)ast_random();
 		p->sessionversion = p->sessionid;
 	} else
 		p->sessionversion++;
@@ -6926,7 +6926,7 @@
 
 	/* Set RTP Session ID and version */
 	if (!p->sessionid) {
-		p->sessionid = (int)abs(ast_random());
+		p->sessionid = (int)ast_random();
 		p->sessionversion = p->sessionid;
 	} else
 		p->sessionversion++;
@@ -8471,7 +8471,7 @@
 		/* SIP isn't up yet, so schedule a poke only, pretty soon */
 		if (peer->pokeexpire > -1)
 			ast_sched_del(sched, peer->pokeexpire);
-		peer->pokeexpire = ast_sched_add(sched, abs(ast_random()) % 5000 + 1, sip_poke_peer_s, peer);
+		peer->pokeexpire = ast_sched_add(sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
 	} else
 		sip_poke_peer(peer);
 	if (peer->expire > -1)




More information about the asterisk-commits mailing list