mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 03:18:30 +00:00
Fix use count for agent/local (bug #2996 et al)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -561,6 +561,10 @@ static int agent_hangup(struct ast_channel *ast)
|
|||||||
* as in apps/app_chanisavail.c:chanavail_exec()
|
* as in apps/app_chanisavail.c:chanavail_exec()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ast_mutex_lock(&usecnt_lock);
|
||||||
|
usecnt--;
|
||||||
|
ast_mutex_unlock(&usecnt_lock);
|
||||||
|
|
||||||
ast_log(LOG_DEBUG, "Hangup called for state %s\n", ast_state2str(ast->_state));
|
ast_log(LOG_DEBUG, "Hangup called for state %s\n", ast_state2str(ast->_state));
|
||||||
if (p->start && (ast->_state != AST_STATE_UP)) {
|
if (p->start && (ast->_state != AST_STATE_UP)) {
|
||||||
howlong = time(NULL) - p->start;
|
howlong = time(NULL) - p->start;
|
||||||
|
|||||||
@@ -312,6 +312,10 @@ static int local_hangup(struct ast_channel *ast)
|
|||||||
p->owner = NULL;
|
p->owner = NULL;
|
||||||
ast->pvt->pvt = NULL;
|
ast->pvt->pvt = NULL;
|
||||||
|
|
||||||
|
ast_mutex_lock(&usecnt_lock);
|
||||||
|
usecnt--;
|
||||||
|
ast_mutex_unlock(&usecnt_lock);
|
||||||
|
|
||||||
if (!p->owner && !p->chan) {
|
if (!p->owner && !p->chan) {
|
||||||
/* Okay, done with the private part now, too. */
|
/* Okay, done with the private part now, too. */
|
||||||
glaredetect = p->glaredetect;
|
glaredetect = p->glaredetect;
|
||||||
@@ -452,6 +456,7 @@ static struct ast_channel *local_new(struct local_pvt *p, int state)
|
|||||||
p->chan = tmp2;
|
p->chan = tmp2;
|
||||||
ast_mutex_lock(&usecnt_lock);
|
ast_mutex_lock(&usecnt_lock);
|
||||||
usecnt++;
|
usecnt++;
|
||||||
|
usecnt++;
|
||||||
ast_mutex_unlock(&usecnt_lock);
|
ast_mutex_unlock(&usecnt_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
strncpy(tmp->context, p->context, sizeof(tmp->context)-1);
|
strncpy(tmp->context, p->context, sizeof(tmp->context)-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user