-/* $Id: connection.c,v 1.1 2007-04-23 21:05:23 adam Exp $
+/* $Id: connection.c,v 1.2 2007-04-24 08:03:03 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
#include "parameters.h"
-// Represents a physical, reusable connection to a remote Z39.50 host
+/** \brief Represents a physical, reusable connection to a remote Z39.50 host
+ */
struct connection {
IOCHAN iochan;
COMSTACK link;
Conn_Open,
Conn_Waiting,
} state;
- struct connection *next;
+ struct connection *next; // next for same host or next in free list
};
static struct connection *connection_freelist = 0;
-void host_remove_connection(struct host *h, struct connection *con)
+static void remove_connection_from_host(struct connection *con)
{
- struct connection **conp = &h->connections;
+ struct connection **conp = &con->host->connections;
assert(con);
while (*conp)
{
// Close connection and recycle structure
void connection_destroy(struct connection *co)
{
- struct host *h = co->host;
-
if (co->link)
{
cs_close(co->link);
yaz_log(YLOG_DEBUG, "Connection destroy %s", co->host->hostport);
- host_remove_connection(h, co);
+ remove_connection_from_host(co);
if (co->client)
{
client_disconnect(co->client);
-/* $Id: connection.h,v 1.1 2007-04-23 21:05:23 adam Exp $
+/* $Id: connection.h,v 1.2 2007-04-24 08:03:03 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct session *se);
int connection_prep_connection(struct connection *co, struct session *se);
const char *connection_get_url(struct connection *co);
+void connection_release(struct connection *co);
#endif
-/* $Id: pazpar2.h,v 1.34 2007-04-23 21:05:23 adam Exp $
+/* $Id: pazpar2.h,v 1.35 2007-04-24 08:03:03 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct record;
struct client;
-struct connection;
-
// Represents a (virtual) database on a host
struct database {
struct host *host;
int host_getaddrinfo(struct host *host);
xmlDoc *normalize_record(struct session_database *sdb, Z_External *rec);
-void connection_destroy(struct connection *co);
struct record *ingest_record(struct client *cl, Z_External *rec,
int record_no);
void session_alert_watch(struct session *s, int what);
-void connection_release(struct connection *co);
void pull_terms(NMEM nmem, struct ccl_rpn_node *n, char **termlist, int *num);
#endif