summaryrefslogtreecommitdiff
path: root/channels/chan_iax.c
diff options
context:
space:
mode:
authorMatteo Brancaleoni <mbrancaleoni@espia.it>2003-02-12 13:59:15 +0000
committerMatteo Brancaleoni <mbrancaleoni@espia.it>2003-02-12 13:59:15 +0000
commit2bd936105e72e2dcc1f847a28f04b2538e83020f (patch)
tree9345a8b61da436462f1b95c568b836a0e4174e6a /channels/chan_iax.c
parentd2f186de49f1a4d7d7d2c7b3e6939aae945f02e9 (diff)
mer feb 12 14:56:57 CET 2003
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@612 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax.c')
-rwxr-xr-xchannels/chan_iax.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/channels/chan_iax.c b/channels/chan_iax.c
index 71ca1e7f9..ce896c738 100755
--- a/channels/chan_iax.c
+++ b/channels/chan_iax.c
@@ -4712,12 +4712,13 @@ static int cache_get_callno(char *data)
for (x=0;x<AST_IAX_MAX_CALLS; x++) {
/* Look for an *exact match* call. Once a call is negotiated, it can only
look up entries for a single context */
- ast_pthread_mutex_lock(&iaxsl[x]);
- if (iaxs[x] && !strcasecmp(data, iaxs[x]->dproot)) {
+ if (!pthread_mutex_trylock(&iaxsl[x])) {
+ if (iaxs[x] && !strcasecmp(data, iaxs[x]->dproot)) {
+ ast_pthread_mutex_unlock(&iaxsl[x]);
+ return x;
+ }
ast_pthread_mutex_unlock(&iaxsl[x]);
- return x;
}
- ast_pthread_mutex_unlock(&iaxsl[x]);
}
/* No match found, we need to create a new one */
strncpy(st, data, sizeof(st)-1);