[asterisk-commits] tilghman: branch 1.4 r133488 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 24 16:17:56 CDT 2008


Author: tilghman
Date: Thu Jul 24 16:17:55 2008
New Revision: 133488

URL: http://svn.digium.com/view/asterisk?view=rev&rev=133488
Log:
Fix rtautoclear and rtcachefriends
(Closes issue #12707)

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=133488&r1=133487&r2=133488
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu Jul 24 16:17:55 2008
@@ -2643,9 +2643,8 @@
 			}
 		}
 		ASTOBJ_CONTAINER_LINK(&peerl,peer);
-	} else {
-		ast_set_flag(&peer->flags[0], SIP_REALTIME);
-	}
+	}
+	ast_set_flag(&peer->flags[0], SIP_REALTIME);
 	if(peerlist)
 		ast_config_destroy(peerlist);
 	else
@@ -2735,8 +2734,8 @@
 		/* Move counter from s to r... */
 		suserobjs--;
 		ruserobjs++;
-		ast_set_flag(&user->flags[0], SIP_REALTIME);
-	}
+	}
+	ast_set_flag(&user->flags[0], SIP_REALTIME);
 	ast_variables_destroy(var);
 	return user;
 }
@@ -8266,7 +8265,7 @@
 		expiry = max_expiry;
 	if (expiry < min_expiry)
 		expiry = min_expiry;
-	if (ast_test_flag(&peer->flags[0], SIP_REALTIME)) {
+	if (ast_test_flag(&peer->flags[0], SIP_REALTIME) && !ast_test_flag(&peer->flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
 		peer->expire = -1;
 	} else {
 		peer->expire = ast_sched_add(sched, (expiry + 10) * 1000, expire_register, ASTOBJ_REF(peer));
@@ -16334,7 +16333,14 @@
 	if (option_debug > 2) 
 		ast_log(LOG_DEBUG, "Checking device state for peer %s\n", host);
 
-	if ((p = find_peer(host, NULL, 1))) {
+	/* If find_peer asks for a realtime peer, then this breaks rtautoclear.  This
+	 * is because when a peer tries to autoexpire, the last thing it does is to
+	 * queue up an event telling the system that the devicestate has changed
+	 * (presumably to unavailable).  If we ask for a realtime peer here, this would
+	 * load it BACK into memory, thus defeating the point of trying to trying to
+	 * clear dead hosts out of memory.
+	 */
+	if ((p = find_peer(host, NULL, 0))) {
 		if (p->addr.sin_addr.s_addr || p->defaddr.sin_addr.s_addr) {
 			/* we have an address for the peer */
 		




More information about the asterisk-commits mailing list