getaddrinfo/host sub system gone
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 3 Mar 2014 14:05:37 +0000 (15:05 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 3 Mar 2014 14:05:37 +0000 (15:05 +0100)
At this point, there's no transfer of connection between sessions.
That was implicitly handled by the host database before.

12 files changed:
src/Makefile.am
src/connection.c
src/connection.h
src/database.c
src/getaddrinfo.c [deleted file]
src/host.c [deleted file]
src/host.h [deleted file]
src/pazpar2_config.c
src/pazpar2_config.h
test/test_http.urls
test/test_limit_limitmap.urls
win/makefile

index 156d677..d537ba9 100644 (file)
@@ -22,8 +22,6 @@ libpazpar2_a_SOURCES = \
        database.c database.h \
        eventl.c eventl.h \
        facet_limit.c facet_limit.h \
-       getaddrinfo.c \
-       host.c host.h \
        http.c http.h http_command.c \
        incref.c incref.h \
        jenkins_hash.c jenkins_hash.h \
index 41e693c..93b9020 100644 (file)
@@ -43,7 +43,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/tcpip.h>
 #include "connection.h"
 #include "session.h"
-#include "host.h"
 #include "client.h"
 #include "settings.h"
 
@@ -89,7 +88,6 @@ int connections_count(void)
 struct connection {
     IOCHAN iochan;
     ZOOM_connection link;
-    struct host *host;
     struct client *client;
     char *zproxy;
     char *url;
@@ -127,22 +125,6 @@ ZOOM_connection connection_get_link(struct connection *co)
     return co->link;
 }
 
-static void remove_connection_from_host(struct connection *con)
-{
-    struct connection **conp = &con->host->connections;
-    assert(con);
-    while (*conp)
-    {
-        if (*conp == con)
-        {
-            *conp = (*conp)->next;
-            break;
-        }
-        conp = &(*conp)->next;
-    }
-    yaz_cond_broadcast(con->host->cond_ready);
-}
-
 // Close connection and recycle structure
 static void connection_destroy(struct connection *co)
 {
@@ -168,7 +150,7 @@ static void connection_destroy(struct connection *co)
 // client's database
 static struct connection *connection_create(struct client *cl,
                                             const char *url,
-                                            struct host *host,
+                                            const char *zproxy,
                                             int operation_timeout,
                                             int session_timeout,
                                             iochan_man_t iochan_man)
@@ -176,24 +158,20 @@ static struct connection *connection_create(struct client *cl,
     struct connection *co;
 
     co = xmalloc(sizeof(*co));
-    co->host = host;
 
     co->client = cl;
     co->url = xstrdup(url);
     co->zproxy = 0;
+    if (zproxy)
+        co->zproxy = xstrdup(zproxy);
+
     client_set_connection(cl, co);
     co->link = 0;
     co->state = Conn_Closed;
     co->operation_timeout = operation_timeout;
     co->session_timeout = session_timeout;
 
-    if (host->ipport)
-        connection_connect(co, iochan_man);
-
-    yaz_mutex_enter(host->mutex);
-    co->next = co->host->connections;
-    co->host->connections = co;
-    yaz_mutex_leave(host->mutex);
+    connection_connect(co, iochan_man);
 
     connection_use(1);
     return co;
@@ -238,7 +216,6 @@ static void non_block_events(struct connection *co)
                     iochan_settimeout(iochan, co->session_timeout);
                     client_set_state(cl, Client_Idle);
                 }
-                yaz_cond_broadcast(co->host->cond_ready);
             }
             break;
         case ZOOM_EVENT_SEND_DATA:
@@ -263,6 +240,8 @@ static void non_block_events(struct connection *co)
         case ZOOM_EVENT_RECV_RECORD:
             client_record_response(cl, &got_records);
             break;
+        case ZOOM_EVENT_NONE:
+            break;
         default:
             yaz_log(YLOG_LOG, "Unhandled event (%d) from %s",
                     ev, client_get_id(cl));
@@ -302,9 +281,7 @@ static void connection_handler(IOCHAN iochan, int event)
 {
     struct connection *co = iochan_getdata(iochan);
     struct client *cl;
-    struct host *host = co->host;
 
-    yaz_mutex_enter(host->mutex);
     cl = co->client;
     if (!cl)
     {
@@ -312,8 +289,6 @@ static void connection_handler(IOCHAN iochan, int event)
            a closed connection from the target.. Or, perhaps, an unexpected
            package.. We will just close the connection */
         yaz_log(YLOG_LOG, "timeout connection %p event=%d", co, event);
-        remove_connection_from_host(co);
-        yaz_mutex_leave(host->mutex);
         connection_destroy(co);
     }
     else if (event & EVENT_TIMEOUT)
@@ -323,14 +298,10 @@ static void connection_handler(IOCHAN iochan, int event)
         non_block_events(co);
         client_unlock(cl);
 
-        remove_connection_from_host(co);
-        yaz_mutex_leave(host->mutex);
         connection_destroy(co);
     }
     else
     {
-        yaz_mutex_leave(host->mutex);
-
         client_lock(cl);
         non_block_events(co);
 
@@ -359,57 +330,8 @@ static void connection_release(struct connection *co)
     co->client = 0;
 }
 
-void connect_resolver_host(struct host *host, iochan_man_t iochan_man)
-{
-    struct connection *con;
-
-    yaz_mutex_enter(host->mutex);
-    con = host->connections;
-    while (con)
-    {
-        if (con->state == Conn_Closed)
-        {
-            if (!host->ipport || !con->client) /* unresolved or no client */
-            {
-                remove_connection_from_host(con);
-                yaz_mutex_leave(host->mutex);
-                connection_destroy(con);
-            }
-            else
-            {
-                struct session_database *sdb = client_get_database(con->client);
-                if (sdb)
-                {
-                    yaz_mutex_leave(host->mutex);
-                    client_start_search(con->client);
-                }
-                else
-                {
-                    remove_connection_from_host(con);
-                    yaz_mutex_leave(host->mutex);
-                    connection_destroy(con);
-                }
-            }
-            /* start all over .. at some point it will be NULL */
-            yaz_mutex_enter(host->mutex);
-            con = host->connections;
-        }
-        else
-        {
-            con = con->next;
-        }
-    }
-    yaz_mutex_leave(host->mutex);
-}
-
-static struct host *connection_get_host(struct connection *con)
-{
-    return con->host;
-}
-
 static int connection_connect(struct connection *con, iochan_man_t iochan_man)
 {
-    struct host *host = connection_get_host(con);
     ZOOM_options zoptions = ZOOM_options_create();
     const char *auth;
     const char *charset;
@@ -433,19 +355,11 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man)
     if (memcached && *memcached)
         ZOOM_options_set(zoptions, "memcached", memcached);
 
-    assert(host->ipport);
-    if (host->proxy)
-    {
-        yaz_log(YLOG_LOG, "proxy=%s", host->ipport);
-        ZOOM_options_set(zoptions, "proxy", host->ipport);
-    }
-    else
+    if (con->zproxy)
     {
-        assert(host->tproxy);
-        yaz_log(YLOG_LOG, "tproxy=%s", host->ipport);
-        ZOOM_options_set(zoptions, "tproxy", host->ipport);
+        yaz_log(YLOG_LOG, "proxy=%s", con->zproxy);
+        ZOOM_options_set(zoptions, "proxy", con->zproxy);
     }
-
     if (apdulog && *apdulog)
         ZOOM_options_set(zoptions, "apdulog", apdulog);
 
@@ -529,9 +443,6 @@ int client_prep_connection(struct client *cl,
     struct session_database *sdb = client_get_database(cl);
     const char *zproxy = session_setting_oneval(sdb, PZ_ZPROXY);
     const char *url = session_setting_oneval(sdb, PZ_URL);
-    const char *sru = session_setting_oneval(sdb, PZ_SRU);
-    struct host *host = 0;
-    int default_port = *sru ? 80 : 210;
 
     if (zproxy && zproxy[0] == '\0')
         zproxy = 0;
@@ -539,110 +450,15 @@ int client_prep_connection(struct client *cl,
     if (!url || !*url)
         url = sdb->database->id;
 
-    host = find_host(client_get_session(cl)->service->server->database_hosts,
-                     url, zproxy, default_port, iochan_man);
-
     yaz_log(YLOG_DEBUG, "client_prep_connection: target=%s url=%s",
             client_get_id(cl), url);
-    if (!host)
-        return 0;
 
     co = client_get_connection(cl);
-    if (co)
-    {
-        assert(co->host);
-        if (co->host == host && client_get_state(cl) == Client_Idle)
-        {
-            return 2;
-        }
-        connection_release(co);
-        co = 0;
-    }
     if (!co)
     {
-        int max_connections = 0;
-        int reuse_connections = 1;
-        const char *v = session_setting_oneval(client_get_database(cl),
-                                               PZ_MAX_CONNECTIONS);
-        if (v && *v)
-            max_connections = atoi(v);
-
-        v = session_setting_oneval(client_get_database(cl),
-                PZ_REUSE_CONNECTIONS);
-        if (v && *v)
-            reuse_connections = atoi(v);
-
-        // See if someone else has an idle connection
-        // We should look at timestamps here to select the longest-idle connection
-        yaz_mutex_enter(host->mutex);
-        while (1)
-        {
-            int num_connections = 0;
-            for (co = host->connections; co; co = co->next)
-                num_connections++;
-            if (reuse_connections)
-            {
-                for (co = host->connections; co; co = co->next)
-                {
-                    if (connection_is_idle(co) &&
-                        !strcmp(url, co->url) &&
-                        (!co->client || client_get_state(co->client) == Client_Idle) &&
-                        !strcmp(ZOOM_connection_option_get(co->link, "user"),
-                                session_setting_oneval(client_get_database(cl),
-                                                       PZ_AUTHENTICATION)))
-                    {
-                        if (zproxy == 0 && co->zproxy == 0)
-                            break;
-                        if (zproxy && co->zproxy && !strcmp(zproxy, co->zproxy))
-                            break;
-                    }
-                }
-                if (co)
-                {
-                    yaz_log(YLOG_LOG, "num_connections = %d (reusing)", num_connections);
-                    break;
-                }
-            }
-            if (max_connections <= 0 || num_connections < max_connections)
-            {
-                yaz_log(YLOG_LOG, "num_connections = %d (new); max = %d",
-                        num_connections, max_connections);
-                break;
-            }
-            yaz_log(YLOG_LOG, "num_connections = %d (waiting) max = %d",
-                    num_connections, max_connections);
-            if (yaz_cond_wait(host->cond_ready, host->mutex, abstime))
-            {
-                yaz_log(YLOG_LOG, "out of connections %s", client_get_id(cl));
-                client_set_state(cl, Client_Error);
-                yaz_mutex_leave(host->mutex);
-                return 0;
-            }
-        }
-        if (co)
-        {
-            yaz_log(YLOG_LOG,  "%p Connection reuse. state: %d", co, co->state);
-            connection_release(co);
-            client_set_connection(cl, co);
-            co->client = cl;
-            /* ensure that connection is only assigned to this client
-               by marking the client non Idle */
-            client_set_state(cl, Client_Working);
-            yaz_mutex_leave(host->mutex);
-            co->operation_timeout = operation_timeout;
-            co->session_timeout = session_timeout;
-            /* tells ZOOM to reconnect if necessary. Disabled becuase
-               the ZOOM_connection_connect flushes the task queue */
-            ZOOM_connection_connect(co->link, 0, 0);
-        }
-        else
-        {
-            yaz_mutex_leave(host->mutex);
-            co = connection_create(cl, url, host,
-                                   operation_timeout, session_timeout,
-                                   iochan_man);
-        }
-        assert(co->host);
+        co = connection_create(cl, url, zproxy,
+                               operation_timeout, session_timeout,
+                               iochan_man);
     }
 
     if (co && co->link)
index e92019e..305b9bd 100644 (file)
@@ -28,12 +28,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "eventl.h"
 
 struct connection;
-struct host;
 
-void connect_resolver_host(struct host *host, iochan_man_t iochan);
 ZOOM_connection connection_get_link(struct connection *co);
 void connection_continue(struct connection *co);
-void connect_resolver_host(struct host *host, iochan_man_t iochan_man);
 
 #endif
 
index 4f95780..681503a 100644 (file)
@@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "ppmutex.h"
 #include "session.h"
-#include "host.h"
 #include "pazpar2_config.h"
 #include "settings.h"
 #include "http.h"
diff --git a/src/getaddrinfo.c b/src/getaddrinfo.c
deleted file mode 100644 (file)
index 2222562..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/* This file is part of Pazpar2.
-   Copyright (C) Index Data
-
-Pazpar2 is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "sel_thread.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-
-#include <assert.h>
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#endif
-#if HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#include <yaz/log.h>
-#include <yaz/nmem.h>
-#include <yaz/tcpip.h>
-
-#include "session.h"
-#include "connection.h"
-#include "host.h"
-
-/* Only use a threaded resolver on Unix that offers getaddrinfo.
-   gethostbyname is NOT reentrant.
- */
-#ifndef WIN32
-#define USE_THREADED_RESOLVER 1
-#endif
-
-struct work {
-    char *hostport;  /* hostport to be resolved in separate thread */
-    char *ipport;    /* result or NULL if it could not be resolved */
-    struct host *host; /* host that we're dealing with - mother thread */
-    iochan_man_t iochan_man; /* iochan manager */
-};
-
-static int log_level = YLOG_LOG;
-
-static void perform_getaddrinfo(struct work *w)
-{
-    struct addrinfo hints, *res;
-    char host[512], *cp;
-    char *port = 0;
-    int error;
-
-    hints.ai_flags = 0;
-    hints.ai_family = AF_UNSPEC;
-    hints.ai_socktype = SOCK_STREAM;
-    hints.ai_protocol = 0;
-    hints.ai_addrlen        = 0;
-    hints.ai_addr           = NULL;
-    hints.ai_canonname      = NULL;
-    hints.ai_next           = NULL;
-
-    strncpy(host, w->hostport, sizeof(host)-1);
-    host[sizeof(host)-1] = 0;
-    if ((cp = strrchr(host, ':')))
-    {
-        *cp = '\0';
-        port = cp + 1;
-    }
-    error = getaddrinfo(host, port ? port : "210", &hints, &res);
-    if (error)
-    {
-        yaz_log(YLOG_WARN, "Failed to resolve %s: %s",
-                w->hostport, gai_strerror(error));
-    }
-    else
-    {
-        char n_host[512];
-        if (getnameinfo((struct sockaddr *) res->ai_addr, res->ai_addrlen,
-                        n_host, sizeof(n_host)-1,
-                        0, 0,
-                        NI_NUMERICHOST) == 0)
-        {
-            w->ipport = xmalloc(strlen(n_host) + (port ? strlen(port) : 0) + 2);
-            strcpy(w->ipport, n_host);
-            if (port)
-            {
-                strcat(w->ipport, ":");
-                strcat(w->ipport, port);
-            }
-            yaz_log(log_level, "Resolved %s -> %s", w->hostport, w->ipport);
-        }
-        else
-        {
-            yaz_log(YLOG_LOG|YLOG_ERRNO, "getnameinfo failed for %s",
-                    w->hostport);
-        }
-        freeaddrinfo(res);
-    }
-}
-
-static void work_handler(void *vp)
-{
-    struct work *w = vp;
-
-    int sec = 0;  /* >0 for debugging/testing purposes */
-    if (sec)
-    {
-        yaz_log(log_level, "waiting %d seconds", sec);
-#if HAVE_UNISTD_H
-        sleep(sec);
-#endif
-    }
-    perform_getaddrinfo(w);
-}
-
-#if USE_THREADED_RESOLVER
-void iochan_handler(struct iochan *i, int event)
-{
-    sel_thread_t p = iochan_getdata(i);
-
-    if (event & EVENT_INPUT)
-    {
-        struct work *w = sel_thread_result(p);
-        w->host->ipport = w->ipport;
-        connect_resolver_host(w->host, w->iochan_man);
-        xfree(w);
-    }
-}
-
-static sel_thread_t resolver_thread = 0;
-
-static void getaddrinfo_start(iochan_man_t iochan_man)
-{
-    int fd;
-    sel_thread_t p = resolver_thread =
-        sel_thread_create(work_handler, 0 /* work_destroy */, &fd,
-                          3 /* no of resolver threads */);
-    if (!p)
-    {
-        yaz_log(YLOG_FATAL|YLOG_ERRNO, "sel_create_create failed");
-        exit(1);
-    }
-    else
-    {
-        IOCHAN chan = iochan_create(fd, iochan_handler, EVENT_INPUT,
-            "getaddrinfo_socket");
-        iochan_setdata(chan, p);
-        iochan_add(iochan_man, chan);
-    }
-    yaz_log(log_level, "resolver start");
-    resolver_thread = p;
-}
-#endif
-
-int host_getaddrinfo(struct host *host, iochan_man_t iochan_man)
-{
-    struct work *w = xmalloc(sizeof(*w));
-    int use_thread = 1; /* =0 to disable threading entirely */
-
-    w->hostport = host->tproxy ? host->tproxy : host->proxy;
-    w->ipport = 0;
-    w->host = host;
-    w->iochan_man = iochan_man;
-#if USE_THREADED_RESOLVER
-    if (use_thread)
-    {
-        if (resolver_thread == 0)
-            getaddrinfo_start(iochan_man);
-        assert(resolver_thread);
-        sel_thread_add(resolver_thread, w);
-        return 0;
-    }
-#endif
-    perform_getaddrinfo(w);
-    host->ipport = w->ipport;
-    xfree(w);
-    if (!host->ipport)
-        return -1;
-    return 0;
-}
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
diff --git a/src/host.c b/src/host.c
deleted file mode 100644 (file)
index 82b94ba..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/* This file is part of Pazpar2.
-   Copyright (C) Index Data
-
-Pazpar2 is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <yaz/log.h>
-#include <yaz/nmem.h>
-#include <yaz/matchstr.h>
-
-#include "ppmutex.h"
-#include "session.h"
-#include "host.h"
-
-#include <sys/types.h>
-
-struct database_hosts {
-    struct host *hosts;
-    YAZ_MUTEX mutex;
-};
-
-// Create a new host structure for hostport
-static struct host *create_host(const char *proxy,
-                                const char *tproxy,
-                                iochan_man_t iochan_man)
-{
-    struct host *host;
-
-    host = xmalloc(sizeof(struct host));
-    host->proxy = 0;
-    host->tproxy = 0;
-    if (proxy && *proxy)
-        host->proxy = xstrdup(proxy);
-    else
-    {
-        assert(tproxy);
-        host->tproxy = xstrdup(tproxy);
-    }
-    host->connections = 0;
-    host->ipport = 0;
-    host->mutex = 0;
-
-    if (host_getaddrinfo(host, iochan_man))
-    {
-        xfree(host->ipport);
-        xfree(host->tproxy);
-        xfree(host->proxy);
-        xfree(host);
-        return 0;
-    }
-    pazpar2_mutex_create(&host->mutex, "host");
-
-    yaz_cond_create(&host->cond_ready);
-
-    return host;
-}
-
-struct host *find_host(database_hosts_t hosts, const char *url,
-                       const char *proxy, int port,
-                       iochan_man_t iochan_man)
-{
-    struct host *p;
-    char *tproxy = 0;
-
-    if (!proxy || !*proxy)
-    {
-        char *cp;
-
-        tproxy = xmalloc (strlen(url) + 10); /* so we can add :port */
-        strcpy(tproxy, url);
-        for (cp = tproxy; *cp; cp++)
-            if (strchr("/?#~", *cp))
-            {
-                *cp = '\0';
-                break;
-            }
-        if (!strchr(tproxy, ':'))
-            sprintf(cp, ":%d", port); /* no port given, add it */
-    }
-    yaz_mutex_enter(hosts->mutex);
-    for (p = hosts->hosts; p; p = p->next)
-    {
-        if (!yaz_strcmp_null(p->tproxy, tproxy) &&
-            !yaz_strcmp_null(p->proxy, proxy))
-        {
-            break;
-        }
-    }
-    if (!p)
-    {
-        p = create_host(proxy, tproxy, iochan_man);
-        if (p)
-        {
-            p->next = hosts->hosts;
-            hosts->hosts = p;
-        }
-    }
-    yaz_mutex_leave(hosts->mutex);
-    xfree(tproxy);
-    return p;
-}
-
-database_hosts_t database_hosts_create(void)
-{
-    database_hosts_t p = xmalloc(sizeof(*p));
-    p->hosts = 0;
-    p->mutex = 0;
-    pazpar2_mutex_create(&p->mutex, "database");
-    return p;
-}
-
-void database_hosts_destroy(database_hosts_t *pp)
-{
-    if (*pp)
-    {
-        struct host *p = (*pp)->hosts;
-        while (p)
-        {
-            struct host *p_next = p->next;
-            yaz_mutex_destroy(&p->mutex);
-            yaz_cond_destroy(&p->cond_ready);
-            xfree(p->ipport);
-            xfree(p);
-            p = p_next;
-        }
-        yaz_mutex_destroy(&(*pp)->mutex);
-        xfree(*pp);
-    }
-}
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
diff --git a/src/host.h b/src/host.h
deleted file mode 100644 (file)
index 7c2144d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* This file is part of Pazpar2.
-   Copyright (C) Index Data
-
-Pazpar2 is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-#ifndef HOST_H
-#define HOST_H
-
-#include <yaz/mutex.h>
-
-typedef struct database_hosts *database_hosts_t;
-
-/** \brief Represents a host (irrespective of databases) */
-struct host {
-    char *tproxy;   // tproxy address (no Z39.50 UI)
-    char *proxy;    // logical proxy address
-    char *ipport;   // tproxy or proxy resolved
-    struct connection *connections; // All connections to this
-    struct host *next;
-    YAZ_MUTEX mutex;
-    YAZ_COND cond_ready;
-};
-
-database_hosts_t database_hosts_create(void);
-void database_hosts_destroy(database_hosts_t *);
-
-struct host *find_host(database_hosts_t hosts, const char *hostport,
-                      const char *proxy, int port, iochan_man_t iochan_man);
-
-int host_getaddrinfo(struct host *host, iochan_man_t iochan_man);
-
-#endif
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
index 4332397..8862123 100644 (file)
@@ -55,7 +55,6 @@ struct conf_config
     int no_threads;
     WRBUF confdir;
     iochan_man_t iochan_man;
-    database_hosts_t database_hosts;
 };
 
 struct service_xslt
@@ -859,7 +858,6 @@ static struct conf_server *server_create(struct conf_config *config,
     server->charsets = 0;
     server->http_server = 0;
     server->iochan_man = 0;
-    server->database_hosts = config->database_hosts;
     server->settings_fname = 0;
 
     if (server_id)
@@ -1282,7 +1280,6 @@ struct conf_config *config_create(const char *fname, int verbose)
     config->servers = 0;
     config->no_threads = 0;
     config->iochan_man = 0;
-    config->database_hosts = database_hosts_create();
 
     config->confdir = wrbuf_alloc();
     if ((p = strrchr(fname,
@@ -1348,7 +1345,6 @@ void config_destroy(struct conf_config *config)
             struct conf_server *s_next = server->next;
             server_destroy(server);
             server = s_next;
-            database_hosts_destroy(&config->database_hosts);
         }
         wrbuf_destroy(config->confdir);
         nmem_destroy(config->nmem);
index 3c03cb3..a5f4a81 100644 (file)
@@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "charsets.h"
 #include "http.h"
 #include "database.h"
-#include "host.h"
 
 enum conf_metadata_type {
     Metadata_type_generic,    // Generic text field
@@ -154,7 +153,6 @@ struct conf_server
     struct conf_config *config;
     http_server_t http_server;
     iochan_man_t iochan_man;
-    database_hosts_t database_hosts;
 };
 
 struct conf_config *config_create(const char *fname, int verbose);
index 3b4f7e9..5d59792 100644 (file)
@@ -68,7 +68,7 @@ http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=aut
 http://localhost:9763/search.pz2?session=9&command=bytarget
 http://localhost:9763/search.pz2?session=9&command=show
 http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=author%3Dadam\,+james%7Cother_author
-http://localhost:9763/search.pz2?session=9&command=bytarget
+1 http://localhost:9763/search.pz2?session=9&command=bytarget
 http://localhost:9763/search.pz2?session=9&command=show
 http://localhost:9763/search.pz2?session=9&command=search&query=computer&limit=Mysubject%3DRailroads
 http://localhost:9763/search.pz2?session=9&command=show&block=1
index 13e1155..1e263ad 100644 (file)
@@ -17,7 +17,7 @@ test_limit_limitmap_settings_3.xml http://localhost:9763/search.pz2?session=1&co
 1 http://localhost:9763/search.pz2?session=1&command=search&query=greece&limit=author%3Dadam\,+james%7Cother_author
 1 http://localhost:9763/search.pz2?session=1&command=show&block=1
 http://localhost:9763/search.pz2?session=1&command=search&query=greece&limit=author%3Dadam\,+james%7Cother_author&filter=pz%3Aid%3DTarget-1
-http://localhost:9763/search.pz2?session=1&command=bytarget
+1 http://localhost:9763/search.pz2?session=1&command=bytarget
 http://localhost:9763/search.pz2?session=1&command=show
 test_limit_limitmap_settings_4.xml http://localhost:9763/search.pz2?session=1&command=settings
 http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=Mysubject%3DRailroads
index 29578c8..312cc21 100644 (file)
@@ -179,8 +179,6 @@ LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
 # Source and object modules
 
 PAZPAR2_OBJS = \
-   "$(OBJDIR)\getaddrinfo.obj" \
-   "$(OBJDIR)\host.obj" \
    "$(OBJDIR)\pazpar2.obj" \
    "$(OBJDIR)\pazpar2_config.obj" \
    "$(OBJDIR)\http.obj" \