The upside of this cleanup is an ease of reading and evaluating with
fewer control paths.

[This patch will only work if patch 2/6 is applied. Sorry.]

Signed-off-by: Pete Zaitcev <zait...@redhat.com>

---
 server/chunkd.h |    2 +-
 server/object.c |    3 +--
 server/server.c |   18 +++++-------------
 3 files changed, 7 insertions(+), 16 deletions(-)

commit 3757c557892446fb91d524e6bbc71fb20a0853ec
Author: Master <zait...@lembas.zaitcev.lan>
Date:   Thu May 20 21:40:43 2010 -0600

    Make cli_wr_set_poll bool.

diff --git a/server/chunkd.h b/server/chunkd.h
index 228ece3..80a377f 100644
--- a/server/chunkd.h
+++ b/server/chunkd.h
@@ -314,7 +314,7 @@ extern bool cli_err(struct client *cli, enum chunk_errcode 
code, bool recycle_ok
 extern int cli_writeq(struct client *cli, const void *buf, unsigned int buflen,
                     cli_write_func cb, void *cb_data);
 extern bool cli_wr_sendfile(struct client *, cli_write_func);
-extern bool cli_wr_set_poll(struct client *cli, bool writable);
+extern void cli_wr_set_poll(struct client *cli, bool writable);
 extern bool cli_cb_free(struct client *cli, struct client_write *wr,
                        bool done);
 extern bool cli_write_start(struct client *cli);
diff --git a/server/object.c b/server/object.c
index 7f6341a..2dd6613 100644
--- a/server/object.c
+++ b/server/object.c
@@ -160,8 +160,7 @@ bool cli_evt_data_in(struct client *cli, unsigned int 
events)
                                return false;
                        if (rc == SSL_ERROR_WANT_WRITE) {
                                cli->read_want_write = true;
-                               if (!cli_wr_set_poll(cli, true))
-                                       return cli_err(cli, che_InternalError, 
false);
+                               cli_wr_set_poll(cli, true);
                                return false;
                        }
                        return cli_err(cli, che_InternalError, false);
diff --git a/server/server.c b/server/server.c
index 801f26c..42eda12 100644
--- a/server/server.c
+++ b/server/server.c
@@ -414,14 +414,12 @@ static bool cli_evt_recycle(struct client *cli, unsigned 
int events)
        return true;
 }
 
-bool cli_wr_set_poll(struct client *cli, bool writable)
+void cli_wr_set_poll(struct client *cli, bool writable)
 {
        if (writable)
                srv_poll_mask(cli->fd, POLLOUT, 0);
        else
                srv_poll_mask(cli->fd, 0, POLLOUT);
-
-       return true;
 }
 
 static int cli_wr_iov(struct client *cli, struct iovec *iov, int max_iov)
@@ -565,9 +563,7 @@ bool cli_write_start(struct client *cli)
                return true;            /* loop, not poll */
        }
 
-       if (!cli_wr_set_poll(cli, true))
-               return true;            /* loop, not poll */
-
+       cli_wr_set_poll(cli, true);
        cli->writing = true;
 
        return false;                   /* poll wait */
@@ -643,8 +639,7 @@ do_read:
                                return 0;
                        if (rc == SSL_ERROR_WANT_WRITE) {
                                cli->read_want_write = true;
-                               if (!cli_wr_set_poll(cli, true))
-                                       return -EIO;
+                               cli_wr_set_poll(cli, true);
                                return 0;
                        }
                        return -EIO;
@@ -1271,14 +1266,12 @@ static bool cli_evt_ssl_accept(struct client *cli, 
unsigned int events)
 
        if (rc == SSL_ERROR_WANT_WRITE) {
                cli->read_want_write = true;
-               if (!cli_wr_set_poll(cli, true))
-                       goto out;
+               cli_wr_set_poll(cli, true);
                return false;
        }
 
        applog(LOG_ERR, "SSL_accept returned %d", rc);
 
-out:
        cli->state = evt_dispose;
        return true;
 }
@@ -1299,8 +1292,7 @@ static void tcp_cli_wr_event(int fd, short events, void 
*userdata)
 
        if (cli->read_want_write) {
                cli->read_want_write = false;
-               if (!cli_wr_set_poll(cli, false))
-                       cli->state = evt_dispose;
+               cli_wr_set_poll(cli, false);
        } else
                cli_writable(cli);
 }
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to