Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
ae915507
Commit
ae915507
authored
Mar 12, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retire VSS_listen()
parent
7e01e2c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
67 deletions
+0
-67
vss.h
include/vss.h
+0
-1
vss.c
lib/libvarnish/vss.c
+0
-66
No files found.
include/vss.h
View file @
ae915507
...
...
@@ -35,4 +35,3 @@ int VSS_resolver(const char *addr, const char *def_port, vss_resolved_f *func,
void
*
priv
,
const
char
**
err
);
int
VSS_resolve
(
const
char
*
addr
,
const
char
*
port
,
struct
vss_addr
***
ta
);
int
VSS_listen
(
const
struct
vss_addr
*
addr
,
int
depth
);
lib/libvarnish/vss.c
View file @
ae915507
...
...
@@ -37,7 +37,6 @@
#include <errno.h>
#include <netdb.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -222,68 +221,3 @@ VSS_resolve(const char *addr, const char *port, struct vss_addr ***vap)
freeaddrinfo
(
res0
);
return
(
i
);
}
/*
* Given a struct vss_addr, open a socket of the appropriate type, and bind
* it to the requested address.
*
* If the address is an IPv6 address, the IPV6_V6ONLY option is set to
* avoid conflicts between INADDR_ANY and IN6ADDR_ANY.
*/
static
int
vss_bind
(
const
struct
vss_addr
*
va
)
{
int
sd
,
val
;
sd
=
socket
(
va
->
va_family
,
va
->
va_socktype
,
va
->
va_protocol
);
if
(
sd
<
0
)
{
perror
(
"socket()"
);
return
(
-
1
);
}
val
=
1
;
if
(
setsockopt
(
sd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
val
,
sizeof
val
)
!=
0
)
{
perror
(
"setsockopt(SO_REUSEADDR, 1)"
);
(
void
)
close
(
sd
);
return
(
-
1
);
}
#ifdef IPV6_V6ONLY
/* forcibly use separate sockets for IPv4 and IPv6 */
val
=
1
;
if
(
va
->
va_family
==
AF_INET6
&&
setsockopt
(
sd
,
IPPROTO_IPV6
,
IPV6_V6ONLY
,
&
val
,
sizeof
val
)
!=
0
)
{
perror
(
"setsockopt(IPV6_V6ONLY, 1)"
);
(
void
)
close
(
sd
);
return
(
-
1
);
}
#endif
if
(
bind
(
sd
,
(
const
void
*
)
&
va
->
va_addr
,
va
->
va_addrlen
)
!=
0
)
{
perror
(
"bind()"
);
(
void
)
close
(
sd
);
return
(
-
1
);
}
return
(
sd
);
}
/*
* Given a struct vss_addr, open a socket of the appropriate type, bind it
* to the requested address, and start listening.
*
* If the address is an IPv6 address, the IPV6_V6ONLY option is set to
* avoid conflicts between INADDR_ANY and IN6ADDR_ANY.
*/
int
VSS_listen
(
const
struct
vss_addr
*
va
,
int
depth
)
{
int
sd
;
sd
=
vss_bind
(
va
);
if
(
sd
>=
0
)
{
if
(
listen
(
sd
,
depth
)
!=
0
)
{
perror
(
"listen()"
);
(
void
)
close
(
sd
);
return
(
-
1
);
}
}
return
(
sd
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment