Merge branch 'bytarget_block' of ssh://git.indexdata.com/home/git/pub/pazpar2 into...
authorDennis Schafroth <dennis@indexdata.com>
Thu, 3 Nov 2011 13:50:04 +0000 (14:50 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Thu, 3 Nov 2011 13:50:04 +0000 (14:50 +0100)
1  2 
src/http_command.c

diff --combined src/http_command.c
@@@ -229,7 -229,7 +229,7 @@@ static const char *get_msg(enum pazpar2
          { PAZPAR2_RECORD_FAIL, "Record command failed"},
          { PAZPAR2_NOT_IMPLEMENTED, "Not implemented"},
          { PAZPAR2_NO_SERVICE, "No service"},
-         { PAZPAR2_ALREADY_BLOCKED, "Already blocked on command in session."},
+         { PAZPAR2_ALREADY_BLOCKED, "Already blocked in session on: "},
          { PAZPAR2_LAST_ERROR, "Last error"},
          { 0, 0 }
      };
@@@ -610,7 -610,8 +610,8 @@@ static void bytarget_response(struct ht
  
      ht = get_hitsbytarget(s->psession, &count, c->nmem);
      response_open(c, "bytarget");
+     if (count == 0)
+         yaz_log(YLOG_WARN, "Empty bytarget Response. No targets found!");
      for (i = 0; i < count; i++)
      {
          wrbuf_puts(c->wrbuf, "\n<target>");
@@@ -668,12 -669,13 +669,13 @@@ static void cmd_bytarget(struct http_ch
      if (!s)
          return;
  
 -    if (block && strcmp("1",block) == 0)
 +    if (block && !strcmp("1",block))
      {
          // if there is already a watch/block. we do not block this one
          if (session_set_watch(s->psession, SESSION_WATCH_BYTARGET,
                                bytarget_result_ready, c, c) != 0)
          {
+             yaz_log(YLOG_WARN, "Attempt to block multiple times on bytarget block. Not supported!");
              error(rs, PAZPAR2_ALREADY_BLOCKED, "bytarget"); 
          }
          else
@@@ -1024,6 -1026,7 +1026,7 @@@ static void cmd_show(struct http_channe
              }
              else
              {
+                 yaz_log(YLOG_WARN, "Attempt to block multiple times on show (preferred targets) block. Not supported!");
                  error(rs, PAZPAR2_ALREADY_BLOCKED, "show (preferred targets)"); 
              }
              release_session(c, s);
              if (session_set_watch(s->psession, SESSION_WATCH_SHOW,
                                    show_records_ready, c, c) != 0)
              {
+                 yaz_log(YLOG_WARN, "Attempt to block multiple times on show block. Not supported!");
                  error(rs, PAZPAR2_ALREADY_BLOCKED, "show"); 
              }
              else