Add session lock for command=settings PAZ-960
[pazpar2-moved-to-github.git] / src / http_command.c
index 1de0354..f4cc792 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Pazpar2.
-   Copyright (C) 2006-2013 Index Data
+   Copyright (C) Index Data
 
 Pazpar2 is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -788,9 +788,9 @@ static void bytarget_response(struct http_channel *c, struct http_session *s,
 
         wrbuf_printf(c->wrbuf, "<records>%d</records>\n",
                      ht[i].records - ht[i].filtered);
+        wrbuf_printf(c->wrbuf, "<filtered>%d</filtered>\n", ht[i].filtered);
         if (version >= 2)
         {
-            wrbuf_printf(c->wrbuf, "<filtered>%d</filtered>\n", ht[i].filtered);
             wrbuf_printf(c->wrbuf, "<approximation>" ODR_INT_PRINTF
                          "</approximation>\n", ht[i].approximation);
         }
@@ -1288,7 +1288,7 @@ static void cmd_show(struct http_channel *c)
 
     status = session_active_clients(s->psession);
 
-    if (block)
+    if (block && reclist_get_num_records(s->psession->reclist) == 0)
     {
         if (!strcmp(block, "preferred")
             && !session_is_preferred_clients_ready(s->psession)