static zoom_ret do_write(ZOOM_connection c);
+ZOOM_API(void) ZOOM_resultset_release(ZOOM_resultset r)
+{
+#if ZOOM_RESULT_LISTS
+#else
+ if (r->connection)
+ {
+ /* remove ourselves from the resultsets in connection */
+ ZOOM_resultset *rp = &r->connection->resultsets;
+ while (1)
+ {
+ assert(*rp); /* we must be in this list!! */
+ if (*rp == r)
+ { /* OK, we're here - take us out of it */
+ *rp = (*rp)->next;
+ break;
+ }
+ rp = &(*rp)->next;
+ }
+ r->connection = 0;
+ }
+#endif
+}
+
ZOOM_API(void)
ZOOM_connection_destroy(ZOOM_connection c)
{
yaz_log(log_details, "%p ZOOM_connection resultset_destroy: Deleting resultset (%p) ", r->connection, r);
ZOOM_resultset_cache_reset(r);
-#if ZOOM_RESULT_LISTS
-#else
- if (r->connection)
- {
- /* remove ourselves from the resultsets in connection */
- ZOOM_resultset *rp = &r->connection->resultsets;
- while (1)
- {
- assert(*rp); /* we must be in this list!! */
- if (*rp == r)
- { /* OK, we're here - take us out of it */
- *rp = (*rp)->next;
- break;
- }
- rp = &(*rp)->next;
- }
- }
-#endif
+ ZOOM_resultset_release(r);
ZOOM_query_destroy(r->query);
ZOOM_options_destroy(r->options);
odr_destroy(r->odr);
#if YAZ_HAVE_XML2
if (*format == '1' && len)
{
- yaz_log(YLOG_LOG, "format=1");
/* try to XML format res */
xmlDocPtr doc;
xmlKeepBlanksDefault(0); /* get get xmlDocFormatMemory to work! */
do_close(c);
}
if (cret == zoom_complete)
- ZOOM_connection_remove_task(c);
- if (!strcmp(hres->version, "1.0"))
{
- /* HTTP 1.0: only if Keep-Alive we stay alive.. */
- if (!connection_head || strcmp(connection_head, "Keep-Alive"))
- do_close(c);
+ yaz_log(YLOG_LOG, "removing tasks in handle_http");
+ ZOOM_connection_remove_task(c);
}
- else
{
- /* HTTP 1.1: only if no close we stay alive .. */
- if (connection_head && !strcmp(connection_head, "close"))
+ int must_close = 0;
+ if (!strcmp(hres->version, "1.0"))
+ {
+ /* HTTP 1.0: only if Keep-Alive we stay alive.. */
+ if (!connection_head || strcmp(connection_head, "Keep-Alive"))
+ must_close = 1;
+ }
+ else
+ {
+ /* HTTP 1.1: only if no close we stay alive.. */
+ if (connection_head && !strcmp(connection_head, "close"))
+ must_close = 1;
+ }
+ if (must_close)
+ {
do_close(c);
+ if (c->tasks)
+ {
+ c->tasks->running = 0;
+ ZOOM_connection_insert_task(c, ZOOM_TASK_CONNECT);
+ c->reconnect_ok = 0;
+ }
+ }
}
}
#endif