* [chunkd patch 6/6] Make cli_wr_set_poll bool
@ 2010-05-21 4:54 Pete Zaitcev
2010-05-25 22:25 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2010-05-21 4:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail List
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);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [chunkd patch 6/6] Make cli_wr_set_poll bool
2010-05-21 4:54 [chunkd patch 6/6] Make cli_wr_set_poll bool Pete Zaitcev
@ 2010-05-25 22:25 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2010-05-25 22:25 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Project Hail List
On 05/21/2010 12:54 AM, Pete Zaitcev wrote:
> 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(-)
ITYM "Make cli_wr_set_poll void"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-25 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 4:54 [chunkd patch 6/6] Make cli_wr_set_poll bool Pete Zaitcev
2010-05-25 22:25 ` Jeff Garzik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.