Here is a patch that fixes the behavior of the callback generated by a
saMsgQueueOpenAsync. The existing code contains two problems:

1. The queue_id should be send as part of the callback request, not
returned in the response structure for the open async API call. This
allows us to copy the queue_id into the queueInstance in the callback
handler (saMsgDispatch).

2. A new queueInstance that is created as via an saMsgQueueOpenAsync
call should not be valid until the corresponding callback has been
processed. The saMsgDispatch code should insert the new queueInstance
into the list contained within msgInstance. The existing code handled
this list insertion in the API call, after we recieved a reponse.

Ryan

Index: services/msg.c
===================================================================
--- services/msg.c      (revision 2119)
+++ services/msg.c      (working copy)
@@ -3495,10 +3495,6 @@
                        MESSAGE_RES_MSG_QUEUEOPENASYNC;
                res_lib_msg_queueopenasync.header.error = error;
 
-               if (queue != NULL) {
-                       res_lib_msg_queueopenasync.queue_id = queue->queue_id;
-               }
-
                if (error == SA_AIS_OK) {
                        msg_pd = api->ipc_private_data_get (
                                req_exec_msg_queueopenasync->source.conn);
@@ -3528,6 +3524,10 @@
                        MESSAGE_RES_MSG_QUEUEOPEN_CALLBACK;
                res_lib_msg_queueopen_callback.header.error = error;
 
+               if (queue != NULL) {
+                       res_lib_msg_queueopen_callback.queue_id = 
queue->queue_id;
+               }
+
                res_lib_msg_queueopen_callback.queue_handle =
                        req_exec_msg_queueopenasync->queue_handle;
                res_lib_msg_queueopen_callback.invocation =
Index: include/ipc_msg.h
===================================================================
--- include/ipc_msg.h   (revision 2119)
+++ include/ipc_msg.h   (working copy)
@@ -141,7 +141,6 @@
 
 struct res_lib_msg_queueopenasync {
        coroipc_response_header_t header __attribute__((aligned(8)));
-       mar_uint32_t queue_id __attribute__((aligned(8)));
 } __attribute__((aligned(8)));
 
 struct req_lib_msg_queueclose {
@@ -392,6 +391,7 @@
        coroipc_response_header_t header __attribute__((aligned(8)));
        mar_msg_queue_handle_t queue_handle __attribute__((aligned(8)));
        mar_invocation_t invocation __attribute__((aligned(8)));
+       mar_uint32_t queue_id __attribute__((aligned(8)));
 } __attribute__((aligned(8)));
 
 struct res_lib_msg_queuegrouptrack_callback {
Index: lib/msg.c
===================================================================
--- lib/msg.c   (revision 2119)
+++ lib/msg.c   (working copy)
@@ -312,6 +312,12 @@
                                break;
                        }
 
+                       queueInstance->queue_id =
+                               res_lib_msg_queueopen_callback->queue_id;
+
+                       list_init (&queueInstance->list);
+                       list_add_tail (&queueInstance->list, 
&msgInstance->queue_list);
+
                        hdb_handle_put (&queueHandleDatabase,
                                res_lib_msg_queueopen_callback->queue_handle);
 
@@ -710,11 +716,6 @@
                goto error_put_destroy;
        }
 
-       queueInstance->queue_id = res_lib_msg_queueopenasync.queue_id;
-
-       list_init (&queueInstance->list);
-       list_add_tail (&queueInstance->list, &msgInstance->queue_list);
-
        hdb_handle_put (&queueHandleDatabase, queueHandle);
        hdb_handle_put (&msgHandleDatabase, msgHandle);
 
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to