aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_gtalk.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-23 22:46:31 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-23 22:46:31 +0000
commitc7776916251e958e39a2fefd6a28a92fda4db23a (patch)
tree13789be06a91f943c067cfb42b6a1219d6328d6f /channels/chan_gtalk.c
parent2fca1655a1f427219d3a65e2c403a76bde344352 (diff)
Update channel drivers to use module referencing so that unloading them while in use will not result in crashes. (issue #8897 reported by junky)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51788 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_gtalk.c')
-rw-r--r--channels/chan_gtalk.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index 44ef9364b..41358eaaf 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -164,9 +164,6 @@ struct gtalk_container {
static const char desc[] = "Gtalk Channel";
-static int usecnt = 0;
-AST_MUTEX_DEFINE_STATIC(usecnt_lock);
-
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
AST_MUTEX_DEFINE_STATIC(gtalklock); /*!< Protect the interface list (of gtalk_pvt's) */
@@ -953,9 +950,7 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i,
if (!ast_strlen_zero(client->musicclass))
ast_string_field_set(tmp, musicclass, client->musicclass);
i->owner = tmp;
- ast_mutex_lock(&usecnt_lock);
- usecnt++;
- ast_mutex_unlock(&usecnt_lock);
+ ast_module_ref(ast_module_info->self);
ast_copy_string(tmp->context, client->context, sizeof(tmp->context));
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
/* Don't use ast_set_callerid() here because it will
@@ -1467,9 +1462,7 @@ static int gtalk_hangup(struct ast_channel *ast)
ast_mutex_unlock(&p->lock);
gtalk_free_pvt(client, p);
- ast_mutex_lock(&usecnt_lock);
- usecnt--;
- ast_mutex_unlock(&usecnt_lock);
+ ast_module_unref(ast_module_info->self);
return 0;
}