aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_h323.c
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-03 03:02:27 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-03 03:02:27 +0000
commit84ed7d5a8dd473636c095153842c1910d3569511 (patch)
treeb3cfa2fc0c3348dbc4054441cc291bc7812b3836 /channels/chan_h323.c
parent21c5f2a514f8e32d03855ecfab69227cbba3269d (diff)
clean up file descriptor leak and check for io before thread cancellation
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1888 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_h323.c')
-rwxr-xr-xchannels/chan_h323.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 15e4b5b22..3d203ca57 100755
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -487,10 +487,13 @@ static int oh323_hangup(struct ast_channel *c)
/* Start the process if it's not already started */
if (!p->alreadygone) {
- if (h323_clear_call((p->cd).call_token))
- ast_log(LOG_DEBUG, "ClearCall failed.\n");
p->needdestroy = 1;
- }
+ }
+
+ /* Tell the H.323 stack to cleanly tare down the call */
+ if (h323_clear_call((p->cd).call_token)) {
+ ast_log(LOG_DEBUG, "ClearCall failed.\n");
+ }
/* Update usage counter */
ast_mutex_lock(&usecnt_lock);
@@ -1236,13 +1239,15 @@ restartsearch:
}
ast_mutex_unlock(&iflock);
- pthread_testcancel();
-
/* Wait for sched or io */
res = ast_sched_wait(sched);
if ((res < 0) || (res > 1000))
res = 1000;
res = ast_io_wait(io, res);
+
+ /* Check for thread cancellation */
+ pthread_testcancel();
+
ast_mutex_lock(&monlock);
if (res >= 0)
ast_sched_runq(sched);