From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [chunkd patch 6/6] Make cli_wr_set_poll bool
Date: Thu, 20 May 2010 22:54:48 -0600 [thread overview]
Message-ID: <20100520225448.49db8ac6@redhat.com> (raw)
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 <zaitcev@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 <zaitcev@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);
}
next reply other threads:[~2010-05-21 4:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 4:54 Pete Zaitcev [this message]
2010-05-25 22:25 ` [chunkd patch 6/6] Make cli_wr_set_poll bool Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100520225448.49db8ac6@redhat.com \
--to=zaitcev@redhat.com \
--cc=hail-devel@vger.kernel.org \
--cc=jeff@garzik.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox