HACK to force ALREADY_BLOCKED response
[pazpar2-moved-to-github.git] / src / http_command.c
index 3723fbe..2809989 100644 (file)
@@ -126,7 +126,7 @@ void http_sessions_destroy(http_sessions_t hs)
         {
             struct http_session *s_next = s->next;
             iochan_destroy(s->timeout_iochan);
-            destroy_session(s->psession);
+            session_destroy(s->psession);
             nmem_destroy(s->nmem);
             s = s_next;
         }
@@ -199,7 +199,7 @@ void http_session_destroy(struct http_session *s)
     {   /* destroying for real */
         yaz_log(http_sessions->log_level, "%p HTTP Session %u destroyed", s, s->session_id);
         iochan_destroy(s->timeout_iochan);
-        destroy_session(s->psession);
+        session_destroy(s->psession);
         http_session_use(-1);
         nmem_destroy(s->nmem);
     }
@@ -574,7 +574,7 @@ static void cmd_termlist(struct http_channel *c)
 
 size_t session_get_memory_status(struct session *session);
 
-static void         (struct http_channel *c, struct http_session *s)
+static void session_status(struct http_channel *c, struct http_session *s)
 {
     size_t session_nmem;
     wrbuf_printf(c->wrbuf, "<http_count>%u</http_count>\n", s->activity_counter);
@@ -666,6 +666,14 @@ static void bytarget_response(struct http_channel *c) {
 
         wrbuf_printf(c->wrbuf, "<hits>" ODR_INT_PRINTF "</hits>\n", ht[i].hits);
         wrbuf_printf(c->wrbuf, "<diagnostic>%d</diagnostic>\n", ht[i].diagnostic);
+        if (ht[i].diagnostic)
+        {
+            wrbuf_puts(c->wrbuf, "<addinfo>");
+            if (ht[i].addinfo)
+                wrbuf_xmlputs(c->wrbuf, ht[i].addinfo);
+            wrbuf_puts(c->wrbuf, "</addinfo>\n");
+        }
+
         wrbuf_printf(c->wrbuf, "<records>%d</records>\n", ht[i].records);
 
         wrbuf_puts(c->wrbuf, "<state>");
@@ -1027,6 +1035,8 @@ static void show_records_ready(void *data)
     show_records(c, -1);
 }
 
+int show_count = 0;
+
 static void cmd_show(struct http_channel *c)
 {
     struct http_request  *rq = c->request;
@@ -1077,7 +1087,9 @@ static void cmd_show(struct http_channel *c)
         {
             // if there is already a watch/block. we do not block this one
             if (session_set_watch(s->psession, SESSION_WATCH_SHOW,
-                                  show_records_ready, c, c) != 0)
+                                  show_records_ready, c, c) != 0
+//                || (++show_count % 6 == 0)
+                )
             {
                 yaz_log(YLOG_WARN, "Attempt to block multiple times on show block. Not supported!");
                 error(rs, PAZPAR2_ALREADY_BLOCKED, "show");