Call client_destroy when releasing it from session
[pazpar2-moved-to-github.git] / src / connection.c
index 2d5d4c4..e765435 100644 (file)
@@ -173,7 +173,6 @@ static void non_block_events(struct connection *co)
             continue;
         ev = ZOOM_connection_last_event(link);
         
-        client_incref(cl);
 #if 0
         yaz_log(YLOG_LOG, "ZOOM_EVENT_%s", ZOOM_get_event_str(ev));
 #endif
@@ -220,25 +219,22 @@ static void non_block_events(struct connection *co)
             yaz_log(YLOG_LOG, "Unhandled event (%d) from %s",
                     ev, client_get_url(cl));
         }
-        client_destroy(cl);
     }
     if (got_records)
     {
         struct client *cl = co->client;
         if (cl)
         {
-            client_incref(cl); 
             client_got_records(cl);
-            client_destroy(cl);
         }
     }
 }
 
 void connection_continue(struct connection *co)
 {
-    ZOOM_connection link = co->link;
-
-    ZOOM_event_nonblock(1, &link);
+    int r = ZOOM_connection_exec_task(co->link);
+    if (!r)
+        yaz_log(YLOG_WARN, "No task was executed for connection");
 }
 
 static void connection_handler(IOCHAN iochan, int event)
@@ -251,6 +247,7 @@ static void connection_handler(IOCHAN iochan, int event)
         /* no client associated with it.. We are probably getting
            a closed connection from the target.. Or, perhaps, an unexpected
            package.. We will just close the connection */
+        yaz_log(YLOG_LOG, "timeout connection %p event=%d", co, event);
         connection_destroy(co);
         return;
     }