aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-11 21:10:52 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-11 21:10:52 +0000
commit8dca428ff0bf3f2cf4b8f70e17d9dc35c1294b19 (patch)
treec9480b19f2144d7c6ab91fc9598df7e6a8437f32 /channel.c
parent86f23150f5242dc5583ebd10ff581549e4dbf402 (diff)
Be fanatic about locking when calling check_hangup
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1293 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/channel.c b/channel.c
index cf1c7a7dd..c5dd1d8b1 100755
--- a/channel.c
+++ b/channel.c
@@ -96,6 +96,15 @@ time_t myt;
return 1;
}
+static int ast_check_hangup_locked(struct ast_channel *chan)
+{
+ int res;
+ ast_pthread_mutex_lock(&chan->lock);
+ res = ast_check_hangup(chan);
+ ast_pthread_mutex_unlock(&chan->lock);
+ return res;
+}
+
void ast_begin_shutdown(int hangup)
{
struct ast_channel *c;
@@ -2067,7 +2076,7 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags
int nativefailed=0;
/* Stop if we're a zombie or need a soft hangup */
- if (c0->zombie || ast_check_hangup(c0) || c1->zombie || ast_check_hangup(c1))
+ if (c0->zombie || ast_check_hangup_locked(c0) || c1->zombie || ast_check_hangup_locked(c1))
return -1;
if (c0->bridge) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",