aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-24 21:27:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-24 21:27:06 +0000
commit0fc56a0dba69d93e63e630f9996d4d32b939ae46 (patch)
tree93a0076a04d985d74fa54de2e2e4508f9a037edc /channels/chan_sip.c
parent6063e344bbdc4111af017512cab1ab68b4764375 (diff)
Merged revisions 133488 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r133488 | tilghman | 2008-07-24 16:17:55 -0500 (Thu, 24 Jul 2008) | 3 lines Fix rtautoclear and rtcachefriends (Closes issue #12707) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@133509 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 0789c2f6b..8150239cb 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3996,10 +3996,8 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
if (peer->addr.sin_addr.s_addr) {
ao2_t_link(peers_by_ip, peer, "link peer into peers_by_ip table");
}
-
- } else {
- peer->is_realtime = 1;
}
+ peer->is_realtime = 1;
if (peerlist)
ast_config_destroy(peerlist);
else {
@@ -10314,7 +10312,7 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
expiry = max_expiry;
if (expiry < min_expiry)
expiry = min_expiry;
- peer->expire = peer->is_realtime ? -1 :
+ peer->expire = peer->is_realtime && !ast_test_flag(&peer->flags[1], SIP_PAGE2_RTCACHEFRIENDS) ? -1 :
ast_sched_add(sched, (expiry + 10) * 1000, expire_register, peer);
pvt->expiry = expiry;
snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry, peer->username, peer->fullcontact);
@@ -20002,7 +20000,14 @@ static int sip_devicestate(void *data)
ast_debug(3, "Checking device state for peer %s\n", host);
- if ((p = find_peer(host, NULL, TRUE, TRUE))) {
+ /* 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 clear dead
+ * hosts out of memory.
+ */
+ if ((p = find_peer(host, NULL, FALSE, TRUE))) {
if (p->addr.sin_addr.s_addr || p->defaddr.sin_addr.s_addr) {
/* we have an address for the peer */