static YAZ_MUTEX g_mutex = 0;
static int no_connections = 0;
static int total_no_connections = 0;
-static void connection_use(int delta)
+
+static int connection_use(int delta)
{
int result;
if (!g_mutex)
yaz_mutex_create(&g_mutex);
yaz_mutex_enter(g_mutex);
no_connections += delta;
- result = no_connection;
+ result = no_connections;
if (delta > 0)
total_no_connections += delta;
yaz_mutex_leave(g_mutex);
return result;
}
-int connections_count() {
+int connections_count(void)
+{
return connection_use(0);
}
co->state = Conn_Resolving;
co->operation_timeout = operation_timeout;
co->session_timeout = session_timeout;
- if (host->ipport)
- connection_connect(co, iochan_man);
+
+ connection_connect(co, iochan_man);
yaz_mutex_enter(host->mutex);
co->next = co->host->connections;
co->client = 0;
}
-void connect_resolver_host(struct host *host, iochan_man_t iochan_man)
-{
- struct connection *con;
-
-start:
- yaz_mutex_enter(host->mutex);
- con = host->connections;
- while (con)
- {
- if (con->state == Conn_Resolving)
- {
- if (!host->ipport) /* unresolved */
- {
- remove_connection_from_host(con);
- yaz_mutex_leave(host->mutex);
- connection_destroy(con);
- goto start;
- /* start all over .. at some point it will be NULL */
- }
- else if (!con->client)
- {
- remove_connection_from_host(con);
- yaz_mutex_leave(host->mutex);
- connection_destroy(con);
- /* start all over .. at some point it will be NULL */
- goto start;
- }
- else
- {
- yaz_mutex_leave(host->mutex);
- connection_connect(con, iochan_man);
- client_start_search(con->client);
- goto start;
- }
- }
- else
- {
- yaz_log(YLOG_LOG, "connect_resolver_host: state=%d", con->state);
- con = con->next;
- }
- }
- yaz_mutex_leave(host->mutex);
-}
-
static struct host *connection_get_host(struct connection *con)
{
return con->host;
const char *zproxy = session_setting_oneval(sdb, PZ_ZPROXY);
const char *apdulog = session_setting_oneval(sdb, PZ_APDULOG);
- assert(host->ipport);
assert(con);
ZOOM_options_set(zoptions, "async", "1");
strcat(http_hostport, host->hostport);
ZOOM_connection_connect(link, http_hostport, 0);
}
- else if (zproxy && *zproxy)
- ZOOM_connection_connect(link, host->hostport, 0);
else
- ZOOM_connection_connect(link, host->ipport, 0);
+ {
+ ZOOM_connection_connect(link, host->hostport, 0);
+ }
con->link = link;
con->iochan = iochan_create(-1, connection_handler, 0, "connection_socket");