From: Adam Dickmeiss Date: Fri, 21 May 2010 09:47:02 +0000 (+0200) Subject: Set client state to Client_Error on ZOOM errors X-Git-Tag: v1.4.1~8 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=76c3727aac232bb2b3606ff5744a0c1fe8d60976;p=pazpar2-moved-to-github.git Set client state to Client_Error on ZOOM errors This sets the state to a proper value -- nice for client statistics but more importantly ensures that we don't reuse a ZOOM connection that has a closed connection. --- diff --git a/src/connection.c b/src/connection.c index 79eb40e..1406811 100644 --- a/src/connection.c +++ b/src/connection.c @@ -207,10 +207,14 @@ static void non_block_events(struct connection *co) { yaz_log(YLOG_LOG, "Error %s from %s", error, client_get_url(cl)); + client_set_diagnostic(cl, err); + client_set_state(cl, Client_Error); + } + else + { + iochan_settimeout(iochan, co->session_timeout); + client_set_state(cl, Client_Idle); } - iochan_settimeout(iochan, co->session_timeout); - client_set_diagnostic(cl, err); - client_set_state(cl, Client_Idle); yaz_cond_broadcast(co->host->cond_ready); } break; @@ -287,15 +291,11 @@ static void connection_handler(IOCHAN iochan, int event) client_set_state(cl, Client_Error); connection_destroy(co); } - else if (client_get_state(co->client) == Client_Idle) + else { yaz_log(YLOG_LOG, "idle timeout %s", client_get_url(cl)); connection_destroy(co); } - else - { - yaz_log(YLOG_LOG, "ignore timeout %s", client_get_url(cl)); - } yaz_mutex_leave(host->mutex); } else