resource-asm: filter non-relevant server events.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Fri, 30 Nov 2012 10:57:38 +0000 (12:57 +0200)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 8 Jan 2015 16:37:09 +0000 (18:37 +0200)
src/plugins/plugin-resource-asm.c
src/plugins/resource-asm/asm-bridge.c

index 9001bf0..e904dec 100644 (file)
@@ -329,6 +329,9 @@ static void event_cb(uint32_t request_id, mrp_resource_set_t *set, void *data)
 
             d->rtype = request_type_server_event;
 
+            /* stop processing server_events */
+            d->request_id = 0;
+
             dump_outgoing_msg(&reply, ctx);
             mrp_transport_senddata(d->ctx->t, &reply, TAG_ASM_TO_LIB);
             break;
@@ -346,7 +349,14 @@ static void event_cb(uint32_t request_id, mrp_resource_set_t *set, void *data)
              * resource present. If yes, tell the availability state changes
              * through it. */
 
-            /* TODO: check if the d->rset state has actually changed */
+            if (d->request_id == 0) {
+                /* We either haven't requested any resources or have
+                 * given up the resources. Filter out events. */
+                break;
+            }
+
+            /* TODO: check if the d->rset state has actually changed -> only
+             * process server side notifications in that case */
 
             if (mrp_get_resource_set_grant(d->rset))
                 reply.sound_command = ASM_COMMAND_PLAY;
index a720ced..c0bb9f0 100644 (file)
@@ -240,12 +240,6 @@ static int send_callback_to_client(asm_to_lib_cb_t *msg, ctx_t *ctx)
     if (ret <= 0 || ret == ASM_FILENAME_SIZE)
         goto error;
 
-    if (access(wr_filename, F_OK) < 0) {
-        mrp_log_error("error accessing file created by ASM client library: %s",
-                strerror(errno));
-        goto error;
-    }
-
     mrp_log_info("writing client preemption to file %s", wr_filename);
 
     wr_fd = open(wr_filename, O_NONBLOCK | O_WRONLY);
@@ -307,8 +301,6 @@ static int send_callback_to_client(asm_to_lib_cb_t *msg, ctx_t *ctx)
         goto error;
     }
 
-    mrp_log_error("Wrote data 0x%08x successfully to client", data);
-
     close(wr_fd);
 
     return 0;