X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzoom-c.c;h=03d0e55d70187c81ee8c78cc91e595ce3407f6c6;hb=8d133ab04af9cc1fe4d2463fb2a0139644ecd6e2;hp=7c791dbbc10c42017977753361204f719f91b3af;hpb=744b4f52caa38c0197331682cc9c89ef9d47da80;p=yaz-moved-to-github.git diff --git a/src/zoom-c.c b/src/zoom-c.c index 7c791db..03d0e55 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -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.114 2007-02-21 12:53:01 adam Exp $ */ /** * \file zoom-c.c @@ -27,6 +27,8 @@ #include #include +#define TASK_FIX 1 + static int log_api = 0; static int log_details = 0; @@ -118,6 +120,13 @@ static ZOOM_Event ZOOM_connection_get_event(ZOOM_connection c) return event; } +static void ZOOM_connection_remove_events(ZOOM_connection c) +{ + ZOOM_Event event; + while ((event = ZOOM_connection_get_event(c))) + ZOOM_Event_destroy(event); +} + ZOOM_API(int) ZOOM_connection_peek_event(ZOOM_connection c) { ZOOM_Event event = c->m_queue_front; @@ -125,6 +134,8 @@ ZOOM_API(int) ZOOM_connection_peek_event(ZOOM_connection c) return event ? event->kind : ZOOM_EVENT_NONE; } +void ZOOM_connection_remove_tasks(ZOOM_connection c); + static void set_dset_error(ZOOM_connection c, int error, const char *dset, const char *addinfo, const char *addinfo2) @@ -150,11 +161,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 +181,7 @@ static void set_HTTP_error(ZOOM_connection c, int error, } #endif + static void set_ZOOM_error(ZOOM_connection c, int error, const char *addinfo) { @@ -180,6 +197,8 @@ static void clear_error(ZOOM_connection c) * or Init Refused are not cleared, because they are not * recoverable: doing another search doesn't help. */ + + ZOOM_connection_remove_events(c); switch (c->error) { case ZOOM_ERROR_CONNECT: @@ -697,6 +716,7 @@ ZOOM_API(void) odr_destroy(c->odr_out); ZOOM_options_destroy(c->options); ZOOM_connection_remove_tasks(c); + ZOOM_connection_remove_events(c); xfree(c->host_port); xfree(c->path); xfree(c->proxy); @@ -1265,7 +1285,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.114 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion =