summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/alsa/alsa-api-mixer.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c
index f0e8b78..f2f3f57 100644
--- a/plugins/alsa/alsa-api-mixer.c
+++ b/plugins/alsa/alsa-api-mixer.c
@@ -548,7 +548,7 @@ STATIC void MixerAttachVerb(afb_req_t request) {
json_object *argsJ = afb_req_json(request);
json_object *responseJ = json_object_new_object();
int error;
- AlsaMixerTransaction * transaction = NULL;
+ AlsaMixerTransaction *transaction = NULL, *existingTransaction;
AFB_API_INFO(mixer->api, "%s: %s", __func__, json_object_get_string(argsJ));
@@ -572,6 +572,17 @@ STATIC void MixerAttachVerb(afb_req_t request) {
goto fail;
}
+ cds_list_for_each_entry(existingTransaction, &mixer->transactionList, transaction_node) {
+ if(! strcmp(uid, existingTransaction->uid)) {
+ AFB_API_INFO(mixer->api,
+ "'attach' call with json '%s' will be ignored because json 'uid' "
+ "has already been used in a previous transaction",
+ json_object_get_string(argsJ));
+ afb_req_success(request, NULL, NULL);
+ return;
+ }
+ }
+
transaction = AlsaMixerTransactionNew(mixer, uid);
if (transaction == NULL) {
SOFTMIXER_NOMEM(mixer->api);