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 \
}
else if (!rc_prep_connection)
{
- session_log(se, YLOG_LOG, "%s: postponing search: No connection",
- client_get_id(cl));
- client_set_state_nb(cl, Client_Working);
+ client_set_diagnostic(cl, 2,
+ ZOOM_diag_str(2),
+ "Cannot create connection");
+ client_set_state_nb(cl, Client_Error);
return -1;
}
co = client_get_connection(cl);
client_set_connection(cl, 0);
}
+void client_mark_dead(struct client *cl)
+{
+ if (cl->connection)
+ connection_mark_dead(cl->connection);
+}
+
void client_stop(struct client *cl)
{
client_lock(cl);
void client_set_connection(struct client *cl, struct connection *con);
void client_disconnect(struct client *cl);
+void client_mark_dead(struct client *cl);
int client_prep_connection(struct client *cl,
int operation_timeout, int session_timeout,
iochan_man_t iochan,
#include <yaz/tcpip.h>
#include "connection.h"
#include "session.h"
-#include "host.h"
#include "client.h"
#include "settings.h"
struct connection {
IOCHAN iochan;
ZOOM_connection link;
- struct host *host;
struct client *client;
char *zproxy;
char *url;
static int connection_connect(struct connection *con, iochan_man_t iochan_man);
-static int connection_is_idle(struct connection *co)
-{
- ZOOM_connection link = co->link;
- int event;
-
- if (co->state != Conn_Open || !link)
- return 0;
-
- if (!ZOOM_connection_is_idle(link))
- return 0;
- event = ZOOM_connection_peek_event(link);
- if (event == ZOOM_EVENT_NONE)
- return 1;
- else
- return 0;
-}
-
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);
+void connection_mark_dead(struct connection *co)
+{
+ iochan_settimeout(co->iochan, 1);
}
// Close connection and recycle structure
// 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)
{
struct connection *co;
+ int ret;
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);
-
+ ret = connection_connect(co, iochan_man);
connection_use(1);
+ if (ret)
+ { /* error */
+ connection_destroy(co);
+ co = 0;
+ }
return 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:
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));
}
}
+static void iochan_update(struct connection *co)
+{
+ if (co->link)
+ {
+ int m = ZOOM_connection_get_mask(co->link);
+
+ if (m == 0)
+ m = ZOOM_SELECT_READ;
+ iochan_setflags(co->iochan, m);
+ iochan_setfd(co->iochan, ZOOM_connection_get_socket(co->link));
+ }
+}
+
void connection_continue(struct connection *co)
{
int r = ZOOM_connection_exec_task(co->link);
client_unlock(cl);
}
else
- {
- iochan_setflags(co->iochan, ZOOM_connection_get_mask(co->link));
- iochan_setfd(co->iochan, ZOOM_connection_get_socket(co->link));
- }
+ iochan_update(co);
}
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)
{
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)
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);
-
+ if (ZOOM_connection_is_idle(co->link))
+ {
+ connection_destroy(co);
+ return;
+ }
client_lock(cl);
non_block_events(co);
non_block_events(co);
client_unlock(cl);
- if (co->link)
- {
- iochan_setflags(iochan, ZOOM_connection_get_mask(co->link));
- iochan_setfd(iochan, ZOOM_connection_get_socket(co->link));
- }
+ iochan_update(co);
}
}
-
-// Disassociate connection from client
-static void connection_release(struct connection *co)
-{
- struct client *cl = co->client;
-
- if (!cl)
- return;
- client_set_connection(cl, 0);
- co->client = 0;
-}
-
void connection_release2(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)
- {
- struct client *cl = con->client;
- if (!host->ipport || !cl) /* 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(cl);
- struct session *se = client_get_session(cl);
- if (sdb && se)
- {
- yaz_mutex_leave(host->mutex);
- client_start_search(cl);
- }
- 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;
if (redis && *redis)
ZOOM_options_set(zoptions, "redis", redis);
- 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);
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;
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;
- }
+ return 2;
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)
#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);
+void connection_mark_dead(struct connection *co);
void connection_release2(struct connection *co);
#endif
#include "ppmutex.h"
#include "session.h"
-#include "host.h"
#include "pazpar2_config.h"
#include "settings.h"
#include "http.h"
+++ /dev/null
-/* 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 */
- int error;
-};
-
-static int log_level = YLOG_LOG;
-
-static void perform_getaddrinfo(struct work *w)
-{
- struct addrinfo hints, *res;
- char host[512], *cp;
- char *port = "210";
- 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;
-
- if (!strncmp(w->hostport, "http://", 7))
- {
- port = "80";
- strncpy(host, w->hostport + 7, sizeof(host)-1);
- }
- else if (!strncmp(w->hostport, "https://", 8))
- {
- port = "443";
- strncpy(host, w->hostport + 8, sizeof(host)-1);
- }
- else
- {
- 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, &hints, &res);
- if (error)
- {
- yaz_log(YLOG_WARN, "Failed to resolve %s: %s",
- w->hostport, gai_strerror(error));
- w->error = 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;
- w->host->error = w->error;
- 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;
- w->error = 0;
-#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;
- host->error = w->error;
- 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
- */
-
+++ /dev/null
-/* 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;
- host->error = 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);
- if (!strncmp(tproxy, "http://", 7))
- cp = tproxy + 7;
- else if (!strncmp(tproxy, "https://", 8))
- cp = tproxy + 8;
- else
- cp = tproxy;
- for (; *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;
- }
- }
- if (p && p->error) /* already resolved error */
- p = 0;
- 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
- */
-
+++ /dev/null
-/* 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
- int error; // resolving error
- 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
- */
-
WRBUF confdir;
char *path;
iochan_man_t iochan_man;
- database_hosts_t database_hosts;
};
struct service_xslt
server->charsets = 0;
server->http_server = 0;
server->iochan_man = 0;
- server->database_hosts = config->database_hosts;
server->settings_fname = 0;
if (server_id)
config->path = nmem_strdup(nmem, ".");
config->no_threads = 0;
config->iochan_man = 0;
- config->database_hosts = database_hosts_create();
config->confdir = wrbuf_alloc();
if ((p = strrchr(fname,
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);
#include "charsets.h"
#include "http.h"
#include "database.h"
-#include "host.h"
enum conf_metadata_type {
Metadata_type_generic, // Generic text field
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);
l->next = se->clients_cached;
se->clients_cached = l;
}
- /* set session always. If may be 0 if client is not active */
client_set_session(cl, se);
l = xmalloc(sizeof(*l));
client_lock(l->client);
client_set_session(l->client, 0);
client_set_database(l->client, 0);
+ client_mark_dead(l->client);
client_unlock(l->client);
client_destroy(l->client);
xfree(l);
w http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=author%3Dadam\,+james%7Cother_author
w http://localhost:9763/search.pz2?session=9&command=show&block=1
http://localhost:9763/search.pz2?session=9&command=search&query=greece&limit=author%3Dadam\,+james%7Cother_author&filter=pz%3Aid%3Dz3950.indexdata.com%2Fmarc
-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=greece&limit=author%3Dadam\,+james%7Cother_author&filter=pz%3Aid%3Dnone
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
w http://localhost:9763/search.pz2?session=1&command=search&query=greece&limit=author%3Dadam\,+james%7Cother_author
w 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
# Source and object modules
PAZPAR2_OBJS = \
- "$(OBJDIR)\getaddrinfo.obj" \
- "$(OBJDIR)\host.obj" \
"$(OBJDIR)\pazpar2.obj" \
"$(OBJDIR)\pazpar2_config.obj" \
"$(OBJDIR)\http.obj" \