Diagnostic member was not set on connection error. Fixed
authorSebastian Hammer <quinn@indexdata.com>
Fri, 23 Oct 2009 18:40:03 +0000 (18:40 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Fri, 23 Oct 2009 18:40:03 +0000 (18:40 +0000)
src/client.c
src/client.h
src/connection.c

index 22d1073..e70a08e 100644 (file)
@@ -795,6 +795,11 @@ int client_get_num_records(struct client *cl)
     return cl->record_offset;
 }
 
+void client_set_diagnostic(struct client *cl, int diagnostic)
+{
+    cl->diagnostic = diagnostic;
+}
+
 int client_get_diagnostic(struct client *cl)
 {
     return cl->diagnostic;
index 93b2e32..35a28d9 100644 (file)
@@ -82,6 +82,7 @@ int client_parse_query(struct client *cl, const char *query);
 int client_get_hits(struct client *cl);
 int client_get_num_records(struct client *cl);
 int client_get_diagnostic(struct client *cl);
+void client_set_diagnostic(struct client *cl, int diagnostic);
 void client_set_database(struct client *cl, struct session_database *db);
 struct host *client_get_host(struct client *cl);
 const char *client_get_url(struct client *cl);
index 7496a1c..8df4ac7 100644 (file)
@@ -183,12 +183,14 @@ static void non_block_events(struct connection *co)
         case ZOOM_EVENT_END:
             {
                 const char *error, *addinfo;
-                if (ZOOM_connection_error(link, &error, &addinfo))
+               int err;
+                if ((err = ZOOM_connection_error(link, &error, &addinfo)))
                 {
                     yaz_log(YLOG_LOG, "Error %s from %s",
                             error, client_get_url(cl));
                 }
                 iochan_settimeout(iochan, co->session_timeout);
+               client_set_diagnostic(cl, err);
                 client_set_state(cl, Client_Idle);
             }
             break;