Changed task queue management a little for ZOOM C.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 21 Feb 2007 09:17:51 +0000 (09:17 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 21 Feb 2007 09:17:51 +0000 (09:17 +0000)
When a diagnostic is produced/received (error condition), the task queue is
cleared immediately. In earlier versions the task queue was cleared when
a new task was inserted in the queue. The effect was that a newly inserted task
was _immediately_ removed and never fired. Hence tasks were silenty
forgotten. The error code is still cleared when a new task is inserted
in the queue.

src/zoom-c.c

index 7c791db..868044e 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: zoom-c.c,v 1.111 2007-02-07 17:52:44 mike Exp $
+ * $Id: zoom-c.c,v 1.112 2007-02-21 09:17:51 adam Exp $
  */
 /**
  * \file zoom-c.c
@@ -27,6 +27,8 @@
 #include <yaz/cql.h>
 #include <yaz/ccl.h>
 
+#define TASK_FIX 1
+
 static int log_api = 0;
 static int log_details = 0;
 
@@ -150,11 +152,16 @@ static void set_dset_error(ZOOM_connection c, int error,
     }
     else if (addinfo)
         c->addinfo = xstrdup(addinfo);
-    if (error)
+    if (error != ZOOM_ERROR_NONE)
+    {
         yaz_log(log_api, "%p set_dset_error %s %s:%d %s %s",
                 c, c->host_port ? c->host_port : "<>", dset, error,
                 addinfo ? addinfo : "",
                 addinfo2 ? addinfo2 : "");
+#if TASK_FIX
+        ZOOM_connection_remove_tasks(c);
+#endif
+    }
 }
 
 #if YAZ_HAVE_XML2
@@ -165,6 +172,8 @@ static void set_HTTP_error(ZOOM_connection c, int error,
 }
 #endif
 
+void ZOOM_connection_remove_tasks(ZOOM_connection c);
+
 static void set_ZOOM_error(ZOOM_connection c, int error,
                            const char *addinfo)
 {
@@ -1265,7 +1274,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c)
                     odr_prepend(c->odr_out, "ZOOM-C",
                                 ireq->implementationName));
     
-    version = odr_strdup(c->odr_out, "$Revision: 1.111 $");
+    version = odr_strdup(c->odr_out, "$Revision: 1.112 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     ireq->implementationVersion =