Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Cluster Development (http://www.linux-archive.org/cluster-development/)
-   -   libcman: E{INTR, AGAIN} in cman_dispatch repeated read needs -1 too (http://www.linux-archive.org/cluster-development/710941-libcman-e-intr-again-cman_dispatch-repeated-read-needs-1-too.html)

Jan Pokorný 10-09-2012 06:31 PM

libcman: E{INTR, AGAIN} in cman_dispatch repeated read needs -1 too
 
Because otherwise, all you get during next cman_dispatch is noise
(i.e., the incoming messages are misaligned wrt. their boundaries).
In better case, this is captured as erroneous field value immediately,
otherwise the result will be pretty crazy.

The hypothetical "proper" fix is either:
- making sure EINTR/EAGAIN does not break atomicity of message
receiving (which in turn may break nonblocking character)
- the part of yet-read message is stored in the handle
(similar to reply_buf{fer,len} items)

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
cman/lib/libcman.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index 6ed8ecb..26c09f2 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -539,13 +539,6 @@ int cman_dispatch(cman_handle_t handle, int flags)
return -1;
}

- if (len < 0 &&
- (errno == EINTR || errno == EAGAIN)) {
- if (bufptr != buf)
- free(bufptr);
- return 0;
- }
-
if (len < 0) {
if (bufptr != buf)
free(bufptr);
--
1.7.11.4


All times are GMT. The time now is 07:28 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.