[master] c99f522 Retire VSS_open
Poul-Henning Kamp
phk at FreeBSD.org
Thu Mar 12 00:12:00 CET 2015
commit c99f522fa084c3a9a4c97f59bb3dad688db4a7a6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Mar 11 23:09:53 2015 +0000
Retire VSS_open
diff --git a/include/vss.h b/include/vss.h
index 1e1233c..7b03943 100644
--- a/include/vss.h
+++ b/include/vss.h
@@ -37,4 +37,3 @@ int VSS_resolver(const char *addr, const char *def_port, vss_resolved_f *func,
int VSS_resolve(const char *addr, const char *port, struct vss_addr ***ta);
int VSS_bind(const struct vss_addr *addr);
int VSS_listen(const struct vss_addr *addr, int depth);
-int VSS_open(const char *str, double tmo);
diff --git a/lib/libvarnish/vss.c b/lib/libvarnish/vss.c
index b837ac1..3038f8c 100644
--- a/lib/libvarnish/vss.c
+++ b/lib/libvarnish/vss.c
@@ -288,61 +288,3 @@ VSS_listen(const struct vss_addr *va, int depth)
}
return (sd);
}
-
-/*
- * Connect to the socket specified by the address info in va.
- * Return the socket.
- */
-static int
-vss_connect(const struct vss_addr *va, int nonblock)
-{
- int sd, i;
-
- sd = socket(va->va_family, va->va_socktype, va->va_protocol);
- if (sd < 0) {
- if (errno != EPROTONOSUPPORT)
- perror("socket()");
- return (-1);
- }
- if (nonblock)
- (void)VTCP_nonblocking(sd);
- i = connect(sd, (const void *)&va->va_addr, va->va_addrlen);
- if (i == 0 || (nonblock && errno == EINPROGRESS))
- return (sd);
- perror("connect()");
- (void)close(sd);
- return (-1);
-}
-
-/*
- * And the totally brutal version: Give me connection to this address
- */
-
-int
-VSS_open(const char *str, double tmo)
-{
- int retval = -1;
- int nvaddr, n, i;
- struct vss_addr **vaddr;
- struct pollfd pfd;
-
- nvaddr = VSS_resolve(str, NULL, &vaddr);
- for (n = 0; n < nvaddr; n++) {
- retval = vss_connect(vaddr[n], tmo != 0.0);
- if (retval >= 0 && tmo != 0.0) {
- pfd.fd = retval;
- pfd.events = POLLOUT;
- i = poll(&pfd, 1, tmo * 1e3);
- if (i == 0 || pfd.revents != POLLOUT) {
- (void)close(retval);
- retval = -1;
- }
- }
- if (retval >= 0)
- break;
- }
- for (n = 0; n < nvaddr; n++)
- free(vaddr[n]);
- free(vaddr);
- return (retval);
-}
More information about the varnish-commit
mailing list