From a697171df7c85e520686503ab3896a73ebe17380 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Fri, 20 Aug 2004 22:18:34 +0000 Subject: [PATCH] Add flow control to saRecvQueue function. (Logical change 1.55) git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@175 fd59a12c-fef9-0310-b244-a6a79926bd2f --- lib/util.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/util.c b/lib/util.c index d84d9e70..258bd441 100644 --- a/lib/util.c +++ b/lib/util.c @@ -96,7 +96,6 @@ saServiceConnect ( return (SA_ERR_TRY_AGAIN); } - req_lib_init.header.magic = MESSAGE_MAGIC; req_lib_init.header.size = sizeof (req_lib_init); req_lib_init.header.id = initType; @@ -114,8 +113,8 @@ saServiceConnect ( /* * Check for security errors */ - if (res_lib_init.error != SA_OK) { - error = res_lib_init.error; + if (res_lib_init.header.error != SA_OK) { + error = res_lib_init.header.error; goto error_exit; } @@ -161,7 +160,7 @@ retry_recv: } struct message_overlay { - struct message_header header; + struct res_header header; char payload[4096]; }; @@ -178,14 +177,14 @@ saRecvQueue ( SaErrorT error; do { - error = saRecvRetry (s, &message.header, sizeof (struct message_header), + error = saRecvRetry (s, &message.header, sizeof (struct res_header), MSG_WAITALL | MSG_NOSIGNAL); if (error != SA_OK) { goto error_exit; } - if (message.header.size > sizeof (struct message_header)) { + if (message.header.size > sizeof (struct req_header)) { error = saRecvRetry (s, &message.payload, - message.header.size - sizeof (struct message_header), + message.header.size - sizeof (struct res_header), MSG_WAITALL | MSG_NOSIGNAL); if (error != SA_OK) { goto error_exit; @@ -228,7 +227,6 @@ saActivatePoll (int s) { * Send activate poll to tell nodeexec to activate poll * on this file descriptor */ - req_lib_activatepoll.header.magic = MESSAGE_MAGIC; req_lib_activatepoll.header.size = sizeof (req_lib_activatepoll); req_lib_activatepoll.header.id = MESSAGE_REQ_LIB_ACTIVATEPOLL;