X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Ftcpip.c;h=c3e477d3a16839a03008cfb07c69b1d5bcecc8ea;hp=87557b2ee021681239440e1d444781e927f438c1;hb=68bbd857190c6e29727ca1f5070fe6d8e5102bbb;hpb=ce1f4b11dd791353e8aa4d434c9f427dcfec2c3e diff --git a/src/tcpip.c b/src/tcpip.c index 87557b2..c3e477d 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -221,6 +221,7 @@ COMSTACK tcpip_type(int s, int flags, int protocol, void *vp) sp->port = 0; #endif sp->ai = 0; + sp->ai_connect = 0; #endif sp->altbuf = 0; sp->altsize = sp->altlen = 0; @@ -481,6 +482,8 @@ static struct addrinfo *wait_resolver_thread(COMSTACK h) return create_net_socket(h); } +#endif + void *tcpip_straddr(COMSTACK h, const char *str) { tcpip_state *sp = (tcpip_state *)h->cprivate; @@ -496,7 +499,7 @@ void *tcpip_straddr(COMSTACK h, const char *str) else port = "80"; } - +#if RESOLVER_THREAD if (sp->pipefd[0] != -1) return 0; if (pipe(sp->pipefd) == -1) @@ -507,25 +510,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; -} - #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); @@ -533,10 +518,9 @@ void *tcpip_straddr(COMSTACK h, const char *str) { return create_net_socket(h); } - return ai; -} - + return sp->ai; #endif +} #else void *tcpip_straddr(COMSTACK h, const char *str) @@ -774,10 +758,7 @@ static int tcpip_bind(COMSTACK h, void *address, int mode) if (h->type == ssl_type && !sp->session) { int res; - gnutls_global_init(); - tcpip_create_cred(h); - res = gnutls_certificate_set_x509_key_file(sp->cred_ptr->xcred, sp->cert_fname, sp->cert_fname,