[master] 041e8c8 Change&Rename VCLS_PollFd() to take struct cli argument instead of fd.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Nov 6 11:30:09 UTC 2017
commit 041e8c81f60bb521caa2d7b68de86e87fcd12bd8
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Nov 6 11:28:44 2017 +0000
Change&Rename VCLS_PollFd() to take struct cli argument instead of fd.
diff --git a/bin/varnishd/cache/cache_cli.c b/bin/varnishd/cache/cache_cli.c
index b674147..d597f42 100644
--- a/bin/varnishd/cache/cache_cli.c
+++ b/bin/varnishd/cache/cache_cli.c
@@ -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");
}
diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index 720bfea..e9c214a 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -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);
}
diff --git a/include/vcli_serve.h b/include/vcli_serve.h
index a1e6bb3..941551d 100644
--- a/include/vcli_serve.h
+++ b/include/vcli_serve.h
@@ -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 */
diff --git a/lib/libvarnish/vcli_serve.c b/lib/libvarnish/vcli_serve.c
index 626ec3a..ea6ea8d 100644
--- a/lib/libvarnish/vcli_serve.c
+++ b/lib/libvarnish/vcli_serve.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;
More information about the varnish-commit
mailing list