Commit 041e8c81 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Change&Rename VCLS_PollFd() to take struct cli argument instead of fd.

parent 4aeb4f63
...@@ -93,13 +93,16 @@ void ...@@ -93,13 +93,16 @@ void
CLI_Run(void) CLI_Run(void)
{ {
int i; int i;
struct cli *cli;
add_check = 1; add_check = 1;
AN(VCLS_AddFd(cache_cls, heritage.cli_in, heritage.cli_out, NULL, NULL)); cli = VCLS_AddFd(cache_cls,
heritage.cli_in, heritage.cli_out, NULL, NULL);
AN(cli);
do { do {
i = VCLS_PollFd(cache_cls, heritage.cli_in, -1); i = VCLS_Poll(cache_cls, cli, -1);
} while (i == 0); } while (i == 0);
VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops"); VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops");
} }
......
...@@ -393,9 +393,8 @@ mgt_cli_callback2(const struct vev *e, int what) ...@@ -393,9 +393,8 @@ mgt_cli_callback2(const struct vev *e, int what)
{ {
int i; int i;
(void)e;
(void)what; (void)what;
i = VCLS_PollFd(mgt_cls, e->fd, 0); i = VCLS_Poll(mgt_cls, e->priv, 0);
return (i); return (i);
} }
......
...@@ -97,7 +97,7 @@ void VCLS_SetHooks(struct VCLS *, cls_cbc_f *, cls_cbc_f *); ...@@ -97,7 +97,7 @@ void VCLS_SetHooks(struct VCLS *, cls_cbc_f *, cls_cbc_f *);
struct cli *VCLS_AddFd(struct VCLS *cs, int fdi, int fdo, cls_cb_f *closefunc, struct cli *VCLS_AddFd(struct VCLS *cs, int fdi, int fdo, cls_cb_f *closefunc,
void *priv); void *priv);
void VCLS_AddFunc(struct VCLS *cs, unsigned auth, struct cli_proto *clp); void VCLS_AddFunc(struct VCLS *cs, unsigned auth, struct cli_proto *clp);
int VCLS_PollFd(struct VCLS *cs, int fd, int timeout); int VCLS_Poll(struct VCLS *cs, const struct cli*, int timeout);
void VCLS_Destroy(struct VCLS **); void VCLS_Destroy(struct VCLS **);
/* From libvarnish/cli.c */ /* From libvarnish/cli.c */
......
...@@ -506,7 +506,7 @@ VCLS_AddFunc(struct VCLS *cs, unsigned auth, struct cli_proto *clp) ...@@ -506,7 +506,7 @@ VCLS_AddFunc(struct VCLS *cs, unsigned auth, struct cli_proto *clp)
} }
int int
VCLS_PollFd(struct VCLS *cs, int fd, int timeout) VCLS_Poll(struct VCLS *cs, const struct cli *cli, int timeout)
{ {
struct VCLS_fd *cfd; struct VCLS_fd *cfd;
struct pollfd pfd[1]; struct pollfd pfd[1];
...@@ -521,7 +521,7 @@ VCLS_PollFd(struct VCLS *cs, int fd, int timeout) ...@@ -521,7 +521,7 @@ VCLS_PollFd(struct VCLS *cs, int fd, int timeout)
i = 0; i = 0;
VTAILQ_FOREACH(cfd, &cs->fds, list) { VTAILQ_FOREACH(cfd, &cs->fds, list) {
if (cfd->fdi != fd) if (cfd->cli != cli)
continue; continue;
pfd[i].fd = cfd->fdi; pfd[i].fd = cfd->fdi;
pfd[i].events = POLLIN; pfd[i].events = POLLIN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment