mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-03 12:25:35 +00:00
clean up file descriptor leak and check for io before thread cancellation
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -487,10 +487,13 @@ static int oh323_hangup(struct ast_channel *c)
|
|||||||
|
|
||||||
/* Start the process if it's not already started */
|
/* Start the process if it's not already started */
|
||||||
if (!p->alreadygone) {
|
if (!p->alreadygone) {
|
||||||
if (h323_clear_call((p->cd).call_token))
|
|
||||||
ast_log(LOG_DEBUG, "ClearCall failed.\n");
|
|
||||||
p->needdestroy = 1;
|
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 */
|
/* Update usage counter */
|
||||||
ast_mutex_lock(&usecnt_lock);
|
ast_mutex_lock(&usecnt_lock);
|
||||||
@@ -1236,13 +1239,15 @@ restartsearch:
|
|||||||
}
|
}
|
||||||
ast_mutex_unlock(&iflock);
|
ast_mutex_unlock(&iflock);
|
||||||
|
|
||||||
pthread_testcancel();
|
|
||||||
|
|
||||||
/* Wait for sched or io */
|
/* Wait for sched or io */
|
||||||
res = ast_sched_wait(sched);
|
res = ast_sched_wait(sched);
|
||||||
if ((res < 0) || (res > 1000))
|
if ((res < 0) || (res > 1000))
|
||||||
res = 1000;
|
res = 1000;
|
||||||
res = ast_io_wait(io, res);
|
res = ast_io_wait(io, res);
|
||||||
|
|
||||||
|
/* Check for thread cancellation */
|
||||||
|
pthread_testcancel();
|
||||||
|
|
||||||
ast_mutex_lock(&monlock);
|
ast_mutex_lock(&monlock);
|
||||||
if (res >= 0)
|
if (res >= 0)
|
||||||
ast_sched_runq(sched);
|
ast_sched_runq(sched);
|
||||||
|
|||||||
Reference in New Issue
Block a user