Make cli_wr_set_poll bool
PATCH 6/6 Make cli_wr_set_poll bool
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 <[email protected]>
--- server/chunkd.h | 2 +- server/object.c | 3 +-- server/server.c | 18 +++++------------- 3 files changed, 7 insertions(+), 16 deletions(-)
commit 3757c557892446fb91d524e6bbc71fb20a0853ec
Author: Master <[email protected]> Date: Thu May 20 21:40:43 2010 -0600
Make cli_wr_set_poll bool.
server/chunkd.h +1 -1
@@ -314,7 +314,7 @@ extern bool cli_err(struct client *cli, enum chunk_errcode code, bool recycle_okextern 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);
server/object.c +1 -2
@@ -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);
server/server.c +5 -13
@@ -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); }
Quoted 5 lines · Pete Zaitcev
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.]
Quoted 7 lines
Signed-off-by Pete Zaitcev<[email protected]>--- 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"