From 6f6ff1a673496677533e190acd7836da7067c839 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Fri, 14 Nov 2003 04:11:03 +0000 Subject: [PATCH] Don't try to expire if there is no expirey git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1748 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax.c | 4 +++- channels/chan_iax2.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/channels/chan_iax.c b/channels/chan_iax.c index 231eec5725..1e801abb42 100755 --- a/channels/chan_iax.c +++ b/channels/chan_iax.c @@ -1594,6 +1594,7 @@ static struct iax_peer *mysql_peer(char *peer) strncpy(p->name, peer, sizeof(p->name) - 1); p->dynamic = 1; p->delme = 1; + p->expire = -1; p->capability = iax_capability; strcpy(p->methods, "md5,plaintext"); } @@ -3447,7 +3448,8 @@ static int update_registry(char *name, struct sockaddr_in *sin, int callno) /* Setup the expirey */ if (p->expire > -1) ast_sched_del(sched, p->expire); - p->expire = ast_sched_add(sched, p->expirey * 1000, expire_registry, (void *)p); + if (p->expirey) + p->expire = ast_sched_add(sched, p->expirey * 1000, expire_registry, (void *)p); MYSNPRINTF "peer=%s;yourip=%s;yourport=%d;refresh=%d;", p->name, inet_ntoa(p->addr.sin_addr), ntohs(p->addr.sin_port), p->expirey); if (p->hascallerid) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index d05e29c311..1458307c1b 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1596,6 +1596,7 @@ static struct iax2_peer *mysql_peer(char *peer) strncpy(p->name, peer, sizeof(p->name) - 1); p->dynamic = 1; p->delme = 1; + p->expire = -1; p->capability = iax2_capability; p->authmethods = IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT; } @@ -3568,7 +3569,8 @@ static int update_registry(char *name, struct sockaddr_in *sin, int callno) /* Setup the expirey */ if (p->expire > -1) ast_sched_del(sched, p->expire); - p->expire = ast_sched_add(sched, p->expirey * 1000, expire_registry, (void *)p); + if (p->expirey) + p->expire = ast_sched_add(sched, p->expirey * 1000, expire_registry, (void *)p); iax_ie_append_str(&ied, IAX_IE_USERNAME, p->name); iax_ie_append_short(&ied, IAX_IE_REFRESH, p->expirey); iax_ie_append_addr(&ied, IAX_IE_APPARENT_ADDR, &p->addr);