projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3ceb91d
)
Prefer IPV6 addresses over IPV4 - should refix bug #2350.
author
Adam Dickmeiss
<adam@indexdata.dk>
Thu, 7 May 2009 18:55:04 +0000
(20:55 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Thu, 7 May 2009 18:55:04 +0000
(20:55 +0200)
src/tcpip.c
patch
|
blob
|
history
diff --git
a/src/tcpip.c
b/src/tcpip.c
index
715d0cf
..
416b707
100644
(file)
--- a/
src/tcpip.c
+++ b/
src/tcpip.c
@@
-434,14
+434,31
@@
void *tcpip_straddr(COMSTACK h, const char *str)
if (sp->ai && h->state == CS_ST_UNBND)
{
int s = -1;
if (sp->ai && h->state == CS_ST_UNBND)
{
int s = -1;
- struct addrinfo *ai = sp->ai;
- for (; ai; ai = ai->ai_next)
+ struct addrinfo *ai;
+ /* try to make IPV6 socket first */
+ for (ai = sp->ai; ai; ai = ai->ai_next)
{
{
- s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
- if (s != -1)
+ if (ai->ai_family == AF_INET6)
{
{
- sp->ai = ai;
- break;
+ s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (s != -1)
+ {
+ sp->ai = ai;
+ break;
+ }
+ }
+ }
+ if (s == -1)
+ {
+ /* no IPV6 could be made.. Try them all */
+ for (ai = sp->ai; ai; ai = ai->ai_next)
+ {
+ s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (s != -1)
+ {
+ sp->ai = ai;
+ break;
+ }
}
}
if (s == -1)
}
}
if (s == -1)