From 76c3727aac232bb2b3606ff5744a0c1fe8d60976 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 21 May 2010 11:47:02 +0200 Subject: [PATCH] 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. --- src/connection.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 -- 1.7.10.4