diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-24 21:17:55 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-24 21:17:55 +0000 |
commit | 551edd2e51a60ce38a529acd627f85af7cbbf359 (patch) | |
tree | 2d8cebaa765509a66966bb97468252ab4b99ed9e /channels | |
parent | 99d9c67ad8ca3161a3752338c54385cdf1aaa2a6 (diff) |
Fix rtautoclear and rtcachefriends
(Closes issue #12707)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@133488 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c88eae2a2..bc93142d0 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2643,9 +2643,8 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i } } 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 @@ static struct sip_user *realtime_user(const char *username) /* 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 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st 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 @@ static int sip_devicestate(void *data) 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 */ |