aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_local.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-09 02:44:37 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-09 02:44:37 +0000
commit142f7a19694aad2bf2d4d2060e40babd3c5efd68 (patch)
tree6dd66423f1ae96d112f308bbb162f228b5a5d62a /channels/chan_local.c
parent6091b3b30dd1ac17cdc38a57a33b548469938ef2 (diff)
Merged revisions 60847 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r60847 | tilghman | 2007-04-08 21:42:48 -0500 (Sun, 08 Apr 2007) | 10 lines Merged revisions 60846 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r60846 | tilghman | 2007-04-08 21:37:18 -0500 (Sun, 08 Apr 2007) | 2 lines Bug 9505 - If the return value for local_queue_frame is set, then p->lock is no longer valid. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@60848 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r--channels/chan_local.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 017daba01..265d685c8 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -214,7 +214,8 @@ static int local_answer(struct ast_channel *ast)
res = local_queue_frame(p, isoutbound, &answer, ast);
} else
ast_log(LOG_WARNING, "Huh? Local is being asked to answer?\n");
- ast_mutex_unlock(&p->lock);
+ if (!res)
+ ast_mutex_unlock(&p->lock);
return res;
}
@@ -294,7 +295,8 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f)
ast_log(LOG_DEBUG, "Not posting to queue since already masked on '%s'\n", ast->name);
res = 0;
}
- ast_mutex_unlock(&p->lock);
+ if (!res)
+ ast_mutex_unlock(&p->lock);
return res;
}
@@ -342,8 +344,8 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da
f.subclass = condition;
f.data = (void*)data;
f.datalen = datalen;
- res = local_queue_frame(p, isoutbound, &f, ast);
- ast_mutex_unlock(&p->lock);
+ if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+ ast_mutex_unlock(&p->lock);
}
return res;
@@ -362,8 +364,8 @@ static int local_digit_begin(struct ast_channel *ast, char digit)
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
f.subclass = digit;
- res = local_queue_frame(p, isoutbound, &f, ast);
- ast_mutex_unlock(&p->lock);
+ if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+ ast_mutex_unlock(&p->lock);
return res;
}
@@ -382,9 +384,9 @@ static int local_digit_end(struct ast_channel *ast, char digit, unsigned int dur
isoutbound = IS_OUTBOUND(ast, p);
f.subclass = digit;
f.len = duration;
- res = local_queue_frame(p, isoutbound, &f, ast);
- ast_mutex_unlock(&p->lock);
-
+ if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+ ast_mutex_unlock(&p->lock);
+
return res;
}
@@ -402,8 +404,8 @@ static int local_sendtext(struct ast_channel *ast, const char *text)
isoutbound = IS_OUTBOUND(ast, p);
f.data = (char *) text;
f.datalen = strlen(text) + 1;
- res = local_queue_frame(p, isoutbound, &f, ast);
- ast_mutex_unlock(&p->lock);
+ if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+ ast_mutex_unlock(&p->lock);
return res;
}
@@ -422,8 +424,8 @@ static int local_sendhtml(struct ast_channel *ast, int subclass, const char *dat
f.subclass = subclass;
f.data = (char *)data;
f.datalen = datalen;
- res = local_queue_frame(p, isoutbound, &f, ast);
- ast_mutex_unlock(&p->lock);
+ if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+ ast_mutex_unlock(&p->lock);
return res;
}
@@ -477,7 +479,7 @@ static int local_hangup(struct ast_channel *ast)
int isoutbound;
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
struct ast_channel *ochan = NULL;
- int glaredetect = 0;
+ int glaredetect = 0, res = 0;
if (!p)
return -1;
@@ -524,8 +526,9 @@ static int local_hangup(struct ast_channel *ast)
/* Need to actually hangup since there is no PBX */
ochan = p->chan;
else
- local_queue_frame(p, isoutbound, &f, NULL);
- ast_mutex_unlock(&p->lock);
+ res = local_queue_frame(p, isoutbound, &f, NULL);
+ if (!res)
+ ast_mutex_unlock(&p->lock);
if (ochan)
ast_hangup(ochan);
return 0;