From 75027807cf88b7c47320c0ec051084c0a0188da6 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 24 Apr 2007 08:03:03 +0000 Subject: [PATCH] Functions connection_destroy, connection_release defined in connectin.h. --- src/connection.c | 15 +++++++-------- src/connection.h | 3 ++- src/pazpar2.h | 6 +----- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/connection.c b/src/connection.c index fc7bf9f..d318033 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1,4 +1,4 @@ -/* $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. @@ -49,7 +49,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #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; @@ -63,14 +64,14 @@ struct connection { 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) { @@ -87,8 +88,6 @@ void host_remove_connection(struct host *h, struct connection *con) // Close connection and recycle structure void connection_destroy(struct connection *co) { - struct host *h = co->host; - if (co->link) { cs_close(co->link); @@ -97,7 +96,7 @@ void connection_destroy(struct connection *co) 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); diff --git a/src/connection.h b/src/connection.h index 4b8a561..328a0f6 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,4 +1,4 @@ -/* $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. @@ -44,6 +44,7 @@ struct connection *connection_get_available(struct connection *con_list, 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 diff --git a/src/pazpar2.h b/src/pazpar2.h index d5c05ea..43f2226 100644 --- a/src/pazpar2.h +++ b/src/pazpar2.h @@ -1,4 +1,4 @@ -/* $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. @@ -43,8 +43,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA struct record; struct client; -struct connection; - // Represents a (virtual) database on a host struct database { struct host *host; @@ -170,12 +168,10 @@ void pazpar2_event_loop(void); 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 -- 1.7.10.4