summaryrefslogtreecommitdiff
path: root/managemon.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-07-12 20:27:40 +1000
committerNeil Brown <neilb@suse.de>2008-07-12 20:27:40 +1000
commitbfa44e2e7afb88a9f2d6083f8ff31c2d50cc78dc (patch)
tree4a4e140f3e3e4611320e872bc2bb88b622dc83ce /managemon.c
parent4d43913ce07ffbcb1ae8e7bdd06a4bd67cd07791 (diff)
downloadmdadm-bfa44e2e7afb88a9f2d6083f8ff31c2d50cc78dc.tar.gz
Revise message passing code.
More here
Diffstat (limited to 'managemon.c')
-rw-r--r--managemon.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/managemon.c b/managemon.c
index 9de0c0c..1917218 100644
--- a/managemon.c
+++ b/managemon.c
@@ -428,7 +428,7 @@ void manage(struct mdstat_ent *mdstat, struct supertype *container)
}
}
-static int handle_message(struct supertype *container, struct md_message *msg)
+static int handle_message(struct supertype *container, struct metadata_update *msg)
{
return -1;
}
@@ -436,7 +436,7 @@ static int handle_message(struct supertype *container, struct md_message *msg)
void read_sock(struct supertype *container)
{
int fd;
- struct md_message msg;
+ struct metadata_update msg;
int terminate = 0;
long fl;
int tmo = 3; /* 3 second timeout before hanging up the socket */
@@ -450,21 +450,15 @@ void read_sock(struct supertype *container)
fcntl(fd, F_SETFL, fl);
do {
- int err;
-
msg.buf = NULL;
/* read and validate the message */
if (receive_message(fd, &msg, tmo) == 0) {
- err = handle_message(container, &msg);
- if (!err)
- ack(fd, msg.seq, tmo);
- else
- nack(fd, err, tmo);
- } else {
+ handle_message(container, &msg);
+ if (ack(fd, tmo) < 0)
+ terminate = 1;
+ } else
terminate = 1;
- nack(fd, -1, tmo);
- }
if (msg.buf)
free(msg.buf);