diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-24 21:31:29 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-24 21:31:29 +0000 |
commit | ff0a0d60d18c2ff0167992e5311910ff8aeadd5f (patch) | |
tree | 393b2e1d39235253c16cd02ee2248d8f5d2ce55d /channels | |
parent | 533d22c24390b620d5d58c6102b547a296e41a13 (diff) |
Merged revisions 133509 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r133509 | tilghman | 2008-07-24 16:27:06 -0500 (Thu, 24 Jul 2008) | 11 lines
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/branches/1.6.0@133524 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 36d8f4f2c..556c10ebc 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3750,9 +3750,8 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i AST_SCHED_REPLACE(peer->expire, sched, global_rtautoclear * 1000, expire_register, (void *) peer); } ASTOBJ_CONTAINER_LINK(&peerl, peer); - } else { - peer->is_realtime = 1; } + peer->is_realtime = 1; if (peerlist) ast_config_destroy(peerlist); else { @@ -9914,7 +9913,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); @@ -19413,7 +19412,14 @@ static int sip_devicestate(void *data) ast_debug(3, "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 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 */ |