This patch changes saMsgMessageGet such that it creates a new ipc
connection each time it is called. The reason for this is that this
call can block for a specified amount of time while waiting for a
message to arrive in a queue. This behavior is needed in order to
implement saMsgMessageCancel, which cancels all pending
saMsgMessageGet calls for a that process.
It is also worth mentioning that you can now create multi-threaded
apps that call saMsgMessageGet in each thread. Writing such an app
will perform quite badly, though, so it is not advised.
This patch also removes several printf statements that were providing
debug information, as well as some nit-pick code cleanup.
Ryan
Index: lib/msg.c
===================================================================
--- lib/msg.c (revision 1874)
+++ lib/msg.c (working copy)
@@ -123,14 +123,14 @@
goto error_no_destroy;
}
- error = hdb_error_to_sa(hdb_handle_create (&msgHandleDatabase,
+ error = hdb_error_to_sa (hdb_handle_create (&msgHandleDatabase,
sizeof (struct msgInstance), msgHandle));
if (error != SA_AIS_OK) {
goto error_no_destroy;
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, *msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ *msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_destroy;
}
@@ -179,13 +179,14 @@
return (SA_AIS_ERR_INVALID_PARAM);
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
return (error);
}
error = coroipcc_fd_get (msgInstance->ipc_handle, &fd);
+
*selectionObject = fd;
hdb_handle_put (&msgHandleDatabase, msgHandle);
@@ -218,8 +219,8 @@
return (SA_AIS_ERR_INVALID_PARAM);
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -240,19 +241,15 @@
if (dispatch_data == NULL) {
if (dispatchFlags == CPG_DISPATCH_ALL) {
- break; /* exit do while cont is 1 loop */
+ break;
} else {
- continue; /* next poll */
+ continue;
}
}
memcpy (&callbacks, &msgInstance->callbacks,
sizeof (msgInstance->callbacks));
- /* DEBUG */
- printf ("[DEBUG]: saMsgDispatch { id = %u }\n",
- (unsigned int)(dispatch_data->id));
-
switch (dispatch_data->id) {
case MESSAGE_RES_MSG_QUEUEOPEN_CALLBACK:
if (callbacks.saMsgQueueOpenCallback == NULL) {
@@ -341,8 +338,8 @@
struct msgInstance *msgInstance;
SaAisErrorT error = SA_AIS_OK;
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
return (error);
}
@@ -354,7 +351,6 @@
msgInstance->finalize = 1;
-
/* msgInstanceFinalize (msgInstance); */
error = coroipcc_service_disconnect (msgInstance->ipc_handle); /* ? */
@@ -384,8 +380,8 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueOpen\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -397,24 +393,18 @@
goto error_exit;
}
- error = hdb_error_to_sa(hdb_handle_create (&queueHandleDatabase,
+ error = hdb_error_to_sa (hdb_handle_create (&queueHandleDatabase,
sizeof (struct queueInstance), queueHandle));
if (error != SA_AIS_OK) {
goto error_put;
}
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
+ error = hdb_error_to_sa (hdb_handle_get (&queueHandleDatabase,
*queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_destroy;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(*queueHandle));
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueName->value));
-
queueInstance->ipc_handle = msgInstance->ipc_handle;
req_lib_msg_queueopen.header.size =
@@ -461,10 +451,6 @@
hdb_handle_put (&queueHandleDatabase, *queueHandle);
hdb_handle_put (&msgHandleDatabase, msgHandle);
- /* DEBUG */
- printf ("[DEBUG]:\t queue_id = %u\n",
- (unsigned int)(res_lib_msg_queueopen.queue_id));
-
return (error);
error_put_destroy:
@@ -497,8 +483,8 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueOpenAsync\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -514,24 +500,18 @@
goto error_put;
}
- error = hdb_error_to_sa(hdb_handle_create (&queueHandleDatabase,
+ error = hdb_error_to_sa (hdb_handle_create (&queueHandleDatabase,
sizeof (struct queueInstance), &queueHandle));
if (error != SA_AIS_OK) {
goto error_put;
}
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
+ error = hdb_error_to_sa (hdb_handle_get (&queueHandleDatabase,
queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_destroy;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(queueHandle));
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueName->value));
-
queueInstance->ipc_handle = msgInstance->ipc_handle;
req_lib_msg_queueopenasync.header.size =
@@ -578,10 +558,6 @@
hdb_handle_put (&queueHandleDatabase, queueHandle);
hdb_handle_put (&msgHandleDatabase, msgHandle);
- /* DEBUG */
- printf ("[DEBUG]:\t queue_id = %u\n",
- (unsigned int)(res_lib_msg_queueopenasync.queue_id));
-
return (error);
error_put_destroy:
@@ -608,18 +584,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueClose\n");
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
queueHandle,
- (void *)&queueInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&queueHandleDatabase,
+ queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(queueHandle));
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueInstance->queue_name.value));
-
req_lib_msg_queueclose.header.size =
sizeof (struct req_lib_msg_queueclose);
req_lib_msg_queueclose.header.id =
@@ -667,16 +637,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueStatusGet\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueName->value));
-
req_lib_msg_queuestatusget.header.size =
sizeof (struct req_lib_msg_queuestatusget);
req_lib_msg_queuestatusget.header.id =
@@ -695,6 +661,8 @@
&res_lib_msg_queuestatusget,
sizeof (struct res_lib_msg_queuestatusget));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_queuestatusget.header.error != SA_AIS_OK) {
error = res_lib_msg_queuestatusget.header.error;
goto error_put; /* ! */
@@ -726,18 +694,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueRetentionTimeSet\n");
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
queueHandle,
- (void *)&queueInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&queueHandleDatabase,
+ queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(queueHandle));
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueInstance->queue_name.value));
-
req_lib_msg_queueretentiontimeset.header.size =
sizeof (struct req_lib_msg_queueretentiontimeset);
req_lib_msg_queueretentiontimeset.header.id =
@@ -786,16 +748,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueUnlink\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueName->value));
-
req_lib_msg_queueunlink.header.size =
sizeof (struct req_lib_msg_queueunlink);
req_lib_msg_queueunlink.header.id =
@@ -841,16 +799,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueGroupCreate\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t group = %s\n",
- (char *)(queueGroupName->value));
-
req_lib_msg_queuegroupcreate.header.size =
sizeof (struct req_lib_msg_queuegroupcreate);
req_lib_msg_queuegroupcreate.header.id =
@@ -898,18 +852,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueGroupInsert\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t group = %s\n",
- (char *)(queueGroupName->value));
- printf ("[DEBUG]:\t queue = %s\n",
- (char *)(queueName->value));
-
req_lib_msg_queuegroupinsert.header.size =
sizeof (struct req_lib_msg_queuegroupinsert);
req_lib_msg_queuegroupinsert.header.id =
@@ -957,18 +905,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueGroupRemove\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t group = %s\n",
- (char *)(queueGroupName->value));
- printf ("[DEBUG]:\t queue = %s\n",
- (char *)(queueName->value));
-
req_lib_msg_queuegroupremove.header.size =
sizeof (struct req_lib_msg_queuegroupremove);
req_lib_msg_queuegroupremove.header.id =
@@ -1015,16 +957,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueGroupDelete\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t group = %s\n",
- (char *)(queueGroupName->value));
-
req_lib_msg_queuegroupdelete.header.size =
sizeof (struct req_lib_msg_queuegroupdelete);
req_lib_msg_queuegroupdelete.header.id =
@@ -1096,8 +1034,8 @@
goto error_exit;
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -1109,10 +1047,6 @@
goto error_put;
}
- /* DEBUG */
- printf ("[DEBUG]:\t group = %s\n",
- (char *)(queueGroupName->value));
-
req_lib_msg_queuegrouptrack.header.size =
sizeof (struct req_lib_msg_queuegrouptrack);
req_lib_msg_queuegrouptrack.header.id =
@@ -1127,15 +1061,6 @@
iov.iov_base = &req_lib_msg_queuegrouptrack;
iov.iov_len = sizeof (struct req_lib_msg_queuegrouptrack);
- /*
- error = coroipcc_msg_send_reply_receive (
- msgInstance->ipc_handle,
- &iov,
- 1,
- &res_lib_msg_queuegrouptrack,
- sizeof (struct res_lib_msg_queuegrouptrack));
- */
-
error = coroipcc_msg_send_reply_receive_in_buf_get (
msgInstance->ipc_handle,
&iov,
@@ -1188,16 +1113,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueGroupTrackStop\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t group = %s\n",
- (char *)(queueGroupName->value));
-
req_lib_msg_queuegrouptrackstop.header.size =
sizeof (struct req_lib_msg_queuegrouptrackstop);
req_lib_msg_queuegrouptrackstop.header.id =
@@ -1242,8 +1163,8 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueGroupNotificationfree\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -1307,16 +1228,12 @@
goto error_exit;
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t destination = %s\n",
- (char *)(destination->value));
-
req_lib_msg_messagesend.header.size =
sizeof (struct req_lib_msg_messagesend) + message->size;
req_lib_msg_messagesend.header.id =
@@ -1334,12 +1251,6 @@
iov[1].iov_base = message->data;
iov[1].iov_len = message->size;
- /* DEBUG */
- printf ("[DEBUG]:\t message->data = %s\n",
- (char *)(message->data));
- printf ("[DEBUG]:\t message->size = %u\n",
- (unsigned int)(message->size));
-
error = coroipcc_msg_send_reply_receive (
msgInstance->ipc_handle,
iov,
@@ -1347,6 +1258,8 @@
&res_lib_msg_messagesend,
sizeof (struct res_lib_msg_messagesend));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_messagesend.header.error != SA_AIS_OK) {
error = res_lib_msg_messagesend.header.error;
goto error_put; /* ! */
@@ -1386,8 +1299,8 @@
goto error_exit;
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -1399,10 +1312,6 @@
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t destination = %s\n",
- (char *)(destination->value));
-
req_lib_msg_messagesendasync.header.size =
sizeof (struct req_lib_msg_messagesendasync) + message->size;
req_lib_msg_messagesendasync.header.id =
@@ -1420,12 +1329,6 @@
iov[1].iov_base = message->data;
iov[1].iov_len = message->size;
- /* DEBUG */
- printf ("[DEBUG]:\t message->data = %s\n",
- (char *)(message->data));
- printf ("[DEBUG]:\t message->size = %u\n",
- (unsigned int)(message->size));
-
error = coroipcc_msg_send_reply_receive (
msgInstance->ipc_handle,
iov,
@@ -1433,6 +1336,8 @@
&res_lib_msg_messagesendasync,
sizeof (struct res_lib_msg_messagesendasync));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_messagesendasync.header.error != SA_AIS_OK) {
error = res_lib_msg_messagesendasync.header.error;
goto error_put; /* ! */
@@ -1456,6 +1361,7 @@
struct req_lib_msg_messageget req_lib_msg_messageget;
struct res_lib_msg_messageget *res_lib_msg_messageget;
struct iovec iov;
+ hdb_handle_t msg_handle;
void * buffer;
@@ -1464,17 +1370,22 @@
/* DEBUG */
printf ("[DEBUG]: saMsgMessageGet\n");
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
queueHandle,
- (void *)&queueInstance));
+ error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
+ queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(queueHandle));
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueInstance->queue_name.value));
+ error = coroipcc_service_connect (
+ COROSYNC_SOCKET_NAME,
+ MSG_SERVICE,
+ IPC_REQUEST_SIZE,
+ IPC_RESPONSE_SIZE,
+ IPC_DISPATCH_SIZE,
+ &msg_handle);
+ if (error != SA_AIS_OK) {
+ goto error_hdb_put;
+ }
req_lib_msg_messageget.header.size =
sizeof (struct req_lib_msg_messageget);
@@ -1492,7 +1403,7 @@
iov.iov_len = sizeof (struct req_lib_msg_messageget);
error = coroipcc_msg_send_reply_receive_in_buf_get (
- queueInstance->ipc_handle,
+ msg_handle,
&iov,
1,
&buffer);
@@ -1501,7 +1412,7 @@
if (res_lib_msg_messageget->header.error != SA_AIS_OK) {
error = res_lib_msg_messageget->header.error;
- goto error_unlock;
+ goto error_disconnect;
}
if (message->data == NULL) {
@@ -1509,13 +1420,13 @@
message->data = malloc (message->size);
if (message->data == NULL) {
error = SA_AIS_ERR_NO_MEMORY;
- goto error_unlock;
+ goto error_ipc_put;
}
}
else {
if (res_lib_msg_messageget->message.size > message->size) {
error = SA_AIS_ERR_NO_SPACE;
- goto error_unlock;
+ goto error_ipc_put;
}
}
@@ -1526,15 +1437,11 @@
*sendTime = res_lib_msg_messageget->send_time;
*senderId = res_lib_msg_messageget->sender_id;
- /* DEBUG */
- printf ("[DEBUG]:\t sender_id = %llu (%llx)\n",
- (unsigned long long)(res_lib_msg_messageget->sender_id),
- (unsigned long long)(res_lib_msg_messageget->sender_id));
-
- error = coroipcc_msg_send_reply_receive_in_buf_put (
- queueInstance->ipc_handle);
-
-error_unlock:
+error_ipc_put:
+ coroipcc_msg_send_reply_receive_in_buf_put (msg_handle);
+error_disconnect:
+ coroipcc_service_disconnect (msg_handle);
+error_hdb_put:
hdb_handle_put (&queueHandleDatabase, queueHandle);
error_exit:
return (error);
@@ -1551,8 +1458,8 @@
/* DEBUG */
printf ("[DEBUG]: saMsgMessageDataFree\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -1582,16 +1489,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgMessageCancel\n");
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
queueHandle,
- (void *)&queueInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&queueHandleDatabase,
+ queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(queueHandle));
-
req_lib_msg_messagecancel.header.size =
sizeof (struct req_lib_msg_messagecancel);
req_lib_msg_messagecancel.header.id =
@@ -1642,16 +1545,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgMessageSendReceive\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t destination = %s\n",
- (char *)(destination->value));
-
req_lib_msg_messagesendreceive.header.size =
sizeof (struct req_lib_msg_messagesendreceive) +
sendMessage->size;
req_lib_msg_messagesendreceive.header.id =
@@ -1669,12 +1568,6 @@
iov[1].iov_base = sendMessage->data;
iov[1].iov_len = sendMessage->size;
- /* DEBUG */
- printf ("[DEBUG]:\t sendMessage->data = %s\n",
- (char *)(sendMessage->data));
- printf ("[DEBUG]:\t sendMessage->size = %u\n",
- (unsigned int)(sendMessage->size));
-
error = coroipcc_msg_send_reply_receive (
msgInstance->ipc_handle,
iov,
@@ -1682,6 +1575,8 @@
&res_lib_msg_messagesendreceive,
sizeof (struct res_lib_msg_messagesendreceive));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_messagesendreceive.header.error != SA_AIS_OK) {
error = res_lib_msg_messagesendreceive.header.error;
goto error_put; /* ! */
@@ -1715,15 +1610,12 @@
goto error_exit;
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t senderId = %llx\n", (unsigned long
long)(*senderId));
-
req_lib_msg_messagereply.header.size =
sizeof (struct req_lib_msg_messagereply) + replyMessage->size;
req_lib_msg_messagereply.header.id =
@@ -1740,12 +1632,6 @@
iov[1].iov_base = replyMessage->data;
iov[1].iov_len = replyMessage->size;
- /* DEBUG */
- printf ("[DEBUG]:\t replyMessage->data = %s\n",
- (char *)(replyMessage->data));
- printf ("[DEBUG]:\t replyMessage->size = %u\n",
- (unsigned int)(replyMessage->size));
-
error = coroipcc_msg_send_reply_receive (
msgInstance->ipc_handle,
iov,
@@ -1753,6 +1639,8 @@
&res_lib_msg_messagereply,
sizeof (struct res_lib_msg_messagereply));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_messagereply.header.error != SA_AIS_OK) {
error = res_lib_msg_messagereply.header.error;
goto error_put; /* ! */
@@ -1787,8 +1675,8 @@
goto error_exit;
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -1800,9 +1688,6 @@
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t senderId = %llx\n", (unsigned long
long)(*senderId));
-
req_lib_msg_messagereplyasync.header.size =
sizeof (struct req_lib_msg_messagereplyasync) +
replyMessage->size;
req_lib_msg_messagereplyasync.header.id =
@@ -1819,12 +1704,6 @@
iov[1].iov_base = replyMessage->data;
iov[1].iov_len = replyMessage->size;
- /* DEBUG */
- printf ("[DEBUG]:\t replyMessage->data = %s\n",
- (char *)(replyMessage->data));
- printf ("[DEBUG]:\t replyMessage->size = %u\n",
- (unsigned int)(replyMessage->size));
-
error = coroipcc_msg_send_reply_receive (
msgInstance->ipc_handle,
iov,
@@ -1832,6 +1711,8 @@
&res_lib_msg_messagereplyasync,
sizeof (struct res_lib_msg_messagereplyasync));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_messagereplyasync.header.error != SA_AIS_OK) {
error = res_lib_msg_messagereplyasync.header.error;
goto error_put; /* ! */
@@ -1858,18 +1739,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueCapacityThresholdSet\n");
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
queueHandle,
- (void *)&queueInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&queueHandleDatabase,
+ queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(queueHandle));
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueInstance->queue_name.value));
-
req_lib_msg_queuecapacitythresholdset.header.size =
sizeof (struct req_lib_msg_queuecapacitythresholdset);
req_lib_msg_queuecapacitythresholdset.header.id =
@@ -1890,6 +1765,8 @@
&res_lib_msg_queuecapacitythresholdset,
sizeof (struct res_lib_msg_queuecapacitythresholdset));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_queuecapacitythresholdset.header.error != SA_AIS_OK) {
error = res_lib_msg_queuecapacitythresholdset.header.error;
goto error_put; /* ! */
@@ -1916,18 +1793,12 @@
/* DEBUG */
printf ("[DEBUG]: saMsgQueueCapacityThresholdGet\n");
- error = hdb_error_to_sa(hdb_handle_get (&queueHandleDatabase,
queueHandle,
- (void *)&queueInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&queueHandleDatabase,
+ queueHandle, (void *)&queueInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
- /* DEBUG */
- printf ("[DEBUG]:\t handle = 0x%04x\n",
- (unsigned int)(queueHandle));
- printf ("[DEBUG]:\t name = %s\n",
- (char *)(queueInstance->queue_name.value));
-
req_lib_msg_queuecapacitythresholdget.header.size =
sizeof (struct req_lib_msg_queuecapacitythresholdget);
req_lib_msg_queuecapacitythresholdget.header.id =
@@ -1948,6 +1819,8 @@
&res_lib_msg_queuecapacitythresholdget,
sizeof (struct res_lib_msg_queuecapacitythresholdget));
+ /* if (error != SA_AIS_OK) */
+
if (res_lib_msg_queuecapacitythresholdget.header.error != SA_AIS_OK) {
error = res_lib_msg_queuecapacitythresholdget.header.error;
goto error_put; /* ! */
@@ -1974,8 +1847,8 @@
/* DEBUG */
printf ("[DEBUG]: saMsgMetadataSizeGet\n");
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
@@ -2027,8 +1900,8 @@
goto error_exit;
}
- error = hdb_error_to_sa(hdb_handle_get (&msgHandleDatabase, msgHandle,
- (void *)&msgInstance));
+ error = hdb_error_to_sa (hdb_handle_get (&msgHandleDatabase,
+ msgHandle, (void *)&msgInstance));
if (error != SA_AIS_OK) {
goto error_exit;
}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais