[svn-commits] rizzo: branch rizzo/astobj2 r47840 - /team/rizzo/astobj2/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Nov 19 03:20:38 MST 2006


Author: rizzo
Date: Sun Nov 19 04:20:38 2006
New Revision: 47840

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47840
Log:
use UNLINK to remove an element from the dialoglist,
and try to make the two blocks more similar.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47840&r1=47839&r2=47840
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sun Nov 19 04:20:38 2006
@@ -15377,26 +15377,22 @@
 			dialoglist_lock();
 			cur = dialoglist;
         		while (cur) {
+				struct sip_pvt *tmp = cur;
+
 				sip_pvt_lock(cur);
+				cur = cur->next;	/* prepare for next iteration */
 				/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
-				check_rtp_timeout(cur, t);
+				check_rtp_timeout(tmp, t);
 				/* If we have sessions that needs to be destroyed, do it now */
-				if (test_destroy(cur) && !cur->packets && !cur->owner) {
+				if (test_destroy(tmp) && !tmp->packets && !tmp->owner) {
 					/* XXX optimized version of sip_destroy() */
-					struct sip_pvt *tmp = cur;
+					/* unlink and free. */
 					sip_pvt_unlock(tmp);
-					/* unlink, and prepare for next iteration */
-					cur = cur->next;
-					if (prev == NULL)
-						dialoglist = cur;
-					else
-						prev->next = cur;
-					/* now we can free the record */
+					UNLINK(tmp, dialoglist, prev);
 					__sip_destroy(tmp);
 				} else {
-					sip_pvt_unlock(cur);
-					prev = cur;
-					cur = cur->next;
+					prev = tmp;
+					sip_pvt_unlock(tmp);
 				}
 			}
 			dialoglist_unlock();



More information about the svn-commits mailing list