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 (from parent 1:
82f1318
)
Minor refactor in tcpip code
author
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 26 Feb 2014 08:57:44 +0000
(09:57 +0100)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 26 Feb 2014 08:57:44 +0000
(09:57 +0100)
src/tcpip.c
patch
|
blob
|
history
diff --git
a/src/tcpip.c
b/src/tcpip.c
index
2cff050
..
72461c1
100644
(file)
--- a/
src/tcpip.c
+++ b/
src/tcpip.c
@@
-481,6
+481,8
@@
static struct addrinfo *wait_resolver_thread(COMSTACK h)
return create_net_socket(h);
}
return create_net_socket(h);
}
+#endif
+
void *tcpip_straddr(COMSTACK h, const char *str)
{
tcpip_state *sp = (tcpip_state *)h->cprivate;
void *tcpip_straddr(COMSTACK h, const char *str)
{
tcpip_state *sp = (tcpip_state *)h->cprivate;
@@
-496,7
+498,7
@@
void *tcpip_straddr(COMSTACK h, const char *str)
else
port = "80";
}
else
port = "80";
}
-
+#if RESOLVER_THREAD
if (sp->pipefd[0] != -1)
return 0;
if (pipe(sp->pipefd) == -1)
if (sp->pipefd[0] != -1)
return 0;
if (pipe(sp->pipefd) == -1)
@@
-507,25
+509,7
@@
void *tcpip_straddr(COMSTACK h, const char *str)
sp->hoststr = xstrdup(str);
sp->thread_id = yaz_thread_create(resolver_thread, h);
return sp->hoststr;
sp->hoststr = xstrdup(str);
sp->thread_id = yaz_thread_create(resolver_thread, h);
return sp->hoststr;
-}
-
#else
#else
-
-void *tcpip_straddr(COMSTACK h, const char *str)
-{
- tcpip_state *sp = (tcpip_state *)h->cprivate;
- const char *port = "210";
- struct addrinfo *ai = 0;
- if (h->protocol == PROTO_HTTP)
- {
- if (h->type == ssl_type)
- port = "443";
- else
- port = "80";
- }
- if (!tcpip_init())
- return 0;
-
if (sp->ai)
freeaddrinfo(sp->ai);
sp->ai = tcpip_getaddrinfo(str, port, &sp->ipv6_only);
if (sp->ai)
freeaddrinfo(sp->ai);
sp->ai = tcpip_getaddrinfo(str, port, &sp->ipv6_only);
@@
-533,10
+517,9
@@
void *tcpip_straddr(COMSTACK h, const char *str)
{
return create_net_socket(h);
}
{
return create_net_socket(h);
}
- return ai;
-}
-
+ return sp->ai;
#endif
#endif
+}
#else
void *tcpip_straddr(COMSTACK h, const char *str)
#else
void *tcpip_straddr(COMSTACK h, const char *str)