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
CLI_Run(void)
{
int i;
struct cli *cli;
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 {
i = VCLS_PollFd(cache_cls, heritage.cli_in, -1);
i = VCLS_Poll(cache_cls, cli, -1);
} while (i == 0);
VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops");
}
......
......@@ -393,9 +393,8 @@ mgt_cli_callback2(const struct vev *e, int what)
{
int i;
(void)e;
(void)what;
i = VCLS_PollFd(mgt_cls, e->fd, 0);
i = VCLS_Poll(mgt_cls, e->priv, 0);
return (i);
}
......
......@@ -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,
void *priv);
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 **);
/* From libvarnish/cli.c */
......
......@@ -506,7 +506,7 @@ VCLS_AddFunc(struct VCLS *cs, unsigned auth, struct cli_proto *clp)
}
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 pollfd pfd[1];
......@@ -521,7 +521,7 @@ VCLS_PollFd(struct VCLS *cs, int fd, int timeout)
i = 0;
VTAILQ_FOREACH(cfd, &cs->fds, list) {
if (cfd->fdi != fd)
if (cfd->cli != cli)
continue;
pfd[i].fd = cfd->fdi;
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