X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fconnection.c;h=c52fcf3880bd782dee745e300cc15bb0dfbc792e;hb=7a8e8e37ed254a29f5085855e6d03fe4ff7573e9;hp=402bfcc62090b8c1d49ba20cb46481fd8f858577;hpb=ec408aa062279768cacf3810db429890cc1ce228;p=pazpar2-moved-to-github.git diff --git a/src/connection.c b/src/connection.c index 402bfcc..c52fcf3 100644 --- a/src/connection.c +++ b/src/connection.c @@ -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: @@ -359,6 +360,11 @@ static void connection_release(struct connection *co) 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; @@ -369,7 +375,8 @@ void connect_resolver_host(struct host *host, iochan_man_t iochan_man) { if (con->state == Conn_Closed) { - if (!host->ipport || !con->client) /* unresolved or no client */ + struct client *cl = con->client; + if (!host->ipport || !cl) /* unresolved or no client */ { remove_connection_from_host(con); yaz_mutex_leave(host->mutex); @@ -377,11 +384,12 @@ void connect_resolver_host(struct host *host, iochan_man_t iochan_man) } else { - struct session_database *sdb = client_get_database(con->client); - if (sdb) + 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(con->client); + client_start_search(cl); } else {