diff options
author | Mark Spencer <markster@digium.com> | 2004-06-04 18:30:35 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-06-04 18:30:35 +0000 |
commit | 0062fe9588f94dbd6b5e11e84f4bb2f171738829 (patch) | |
tree | 6f82f246e641514ddf7f3f9e1b6d3b00942ffae8 /channels | |
parent | 103bb4a33480fe9f7e484a851deaef458a40a69b (diff) |
IAX2 fixup, fix res_monitor sillyseg
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3144 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_iax2.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index fa8e3df4c..a2257fe38 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -6421,7 +6421,7 @@ int reload(void) return reload_config(); } -static int cache_get_callno(char *data) +static int cache_get_callno_locked(char *data) { struct sockaddr_in sin; int x; @@ -6437,7 +6437,6 @@ static int cache_get_callno(char *data) look up entries for a single context */ if (!ast_mutex_trylock(&iaxsl[x])) { if (iaxs[x] && !strcasecmp(data, iaxs[x]->dproot)) { - ast_mutex_unlock(&iaxsl[x]); return x; } ast_mutex_unlock(&iaxsl[x]); @@ -6501,7 +6500,6 @@ static int cache_get_callno(char *data) #endif /* Start the call going */ send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_NEW, 0, ied.buf, ied.pos, -1); - ast_mutex_unlock(&iaxsl[callno]); return callno; } @@ -6548,14 +6546,16 @@ static struct iax2_dpcache *find_cache(struct ast_channel *chan, char *data, cha if (!dp) { /* No matching entry. Create a new one. */ /* First, can we make a callno? */ - callno = cache_get_callno(data); + callno = cache_get_callno_locked(data); if (callno < 0) { ast_log(LOG_WARNING, "Unable to generate call for '%s'\n", data); return NULL; } dp = malloc(sizeof(struct iax2_dpcache)); - if (!dp) + if (!dp) { + ast_mutex_unlock(&iaxsl[callno]); return NULL; + } memset(dp, 0, sizeof(struct iax2_dpcache)); strncpy(dp->peercontext, data, sizeof(dp->peercontext)-1); strncpy(dp->exten, exten, sizeof(dp->exten)-1); @@ -6573,6 +6573,7 @@ static struct iax2_dpcache *find_cache(struct ast_channel *chan, char *data, cha /* Send the request if we're already up */ if (iaxs[callno]->state & IAX_STATE_STARTED) iax2_dprequest(dp, callno); + ast_mutex_unlock(&iaxsl[callno]); } /* By here we must have a dp */ if (dp->flags & CACHE_FLAG_PENDING) { |