diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-27 16:38:38 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-27 16:38:38 +0000 |
commit | 70acf081a2a07636339924ee023aa9ccfd7af54c (patch) | |
tree | eb19cf47d7e1cf19eca038cc22ba2f021cbf3ece /apps | |
parent | c3ad111faf9ead67ec703cd8dd42844723c0bff0 (diff) |
Add a unique id to the datastore allocated in app_chanspy since
it is possible that multiple spies may be listening to the same
channel.
(closes issue #12376)
Reported by: DougUDI
Patches:
12376_chanspy_uid.diff uploaded by putnopvut (license 60)
Tested by: destiny6628
(closes issue #12243)
Reported by: atis
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@118365 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_chanspy.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index b58b6d1ef..295ba9a37 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -415,11 +415,13 @@ static struct chanspy_ds *chanspy_ds_free(struct chanspy_ds *chanspy_ds) if (chanspy_ds->chan) { struct ast_datastore *datastore; struct ast_channel *chan; + char uid[20]; chan = chanspy_ds->chan; ast_channel_lock(chan); - if ((datastore = ast_channel_datastore_find(chan, &chanspy_ds_info, NULL))) { + snprintf(uid, sizeof(uid), "%p", chanspy_ds); + if ((datastore = ast_channel_datastore_find(chan, &chanspy_ds_info, uid))) { ast_channel_datastore_remove(chan, datastore); /* chanspy_ds->chan is NULL after this call */ chanspy_ds_destroy(datastore->data); @@ -437,10 +439,13 @@ static struct chanspy_ds *chanspy_ds_free(struct chanspy_ds *chanspy_ds) static struct chanspy_ds *setup_chanspy_ds(struct ast_channel *chan, struct chanspy_ds *chanspy_ds) { struct ast_datastore *datastore = NULL; + char uid[20]; ast_mutex_lock(&chanspy_ds->lock); - if (!(datastore = ast_channel_datastore_alloc(&chanspy_ds_info, NULL))) { + snprintf(uid, sizeof(uid), "%p", chanspy_ds); + + if (!(datastore = ast_channel_datastore_alloc(&chanspy_ds_info, uid))) { ast_mutex_unlock(&chanspy_ds->lock); chanspy_ds = chanspy_ds_free(chanspy_ds); ast_channel_unlock(chan); |