X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fconnection.c;h=3afc75f718db8d8023c6c04f8dd553612bc865f6;hb=00a7d6c07a2b38f10cb071b71c91e8dc5f8b20ef;hp=d2c9b7042bd3760d0c1860951d78c4168898b2e9;hpb=9e8d657340483f6af7169828917da385f8e6ee9f;p=pazpar2-moved-to-github.git diff --git a/src/connection.c b/src/connection.c index d2c9b70..3afc75f 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1,5 +1,5 @@ /* This file is part of Pazpar2. - Copyright (C) 2006-2013 Index Data + 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 @@ -228,8 +228,10 @@ static void non_block_events(struct connection *co) int err; if ((err = ZOOM_connection_error(link, &error, &addinfo))) { - yaz_log(YLOG_LOG, "Error %s from %s", - error, client_get_id(cl)); + struct session *se = client_get_session(cl); + + session_log(se, YLOG_WARN, "%s: Error %s (%s)", + client_get_id(cl), error, addinfo); client_set_diagnostic(cl, err, error, addinfo); client_set_state(cl, Client_Error); } @@ -254,7 +256,6 @@ static void non_block_events(struct connection *co) case ZOOM_EVENT_RECV_APDU: break; case ZOOM_EVENT_CONNECT: - yaz_log(YLOG_LOG, "Connected to %s", client_get_id(cl)); co->state = Conn_Open; break; case ZOOM_EVENT_RECV_SEARCH: @@ -284,7 +285,13 @@ void connection_continue(struct connection *co) { int r = ZOOM_connection_exec_task(co->link); if (!r) + { + struct client *cl = co->client; + + client_lock(cl); non_block_events(co); + client_unlock(cl); + } else { iochan_setflags(co->iochan, ZOOM_connection_get_mask(co->link)); @@ -390,7 +397,6 @@ void connect_resolver_host(struct host *host, iochan_man_t iochan_man) } else { - yaz_log(YLOG_LOG, "connect_resolver_host: state=%d", con->state); con = con->next; } } @@ -415,6 +421,8 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) struct session_database *sdb = client_get_database(con->client); const char *apdulog = session_setting_oneval(sdb, PZ_APDULOG); + const char *memcached = session_setting_oneval(sdb, PZ_MEMCACHED); + const char *redis = session_setting_oneval(sdb, PZ_REDIS); assert(con); @@ -424,6 +432,10 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) if ((charset = session_setting_oneval(sdb, PZ_NEGOTIATION_CHARSET))) ZOOM_options_set(zoptions, "charset", charset); + if (memcached && *memcached) + ZOOM_options_set(zoptions, "memcached", memcached); + if (redis && *redis) + ZOOM_options_set(zoptions, "redis", redis); assert(host->ipport); if (host->proxy) @@ -452,7 +464,7 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) { /* allow splitting user and reset with a blank always */ const char *cp1 = strchr(auth, ' '); - if (!cp1 && sru && *sru_version) + if (!cp1 && sru && *sru) cp1 = strchr(auth, '/'); if (!cp1) {