Merge branch 'master' into bug_4688
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 10 Nov 2011 10:05:14 +0000 (11:05 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 10 Nov 2011 10:05:14 +0000 (11:05 +0100)
1  2 
src/client.c
src/client.h
src/session.c
src/session.h

diff --cc src/client.c
Simple merge
diff --cc src/client.h
Simple merge
diff --cc src/session.c
@@@ -670,19 -619,15 +639,15 @@@ void session_sort(struct session *se, c
      sr->next = se->sorted_results;
      se->sorted_results = sr;
      
 -    for (l = se->clients; l; l = l->next)
 +    for (l = se->clients_active; l; l = l->next)
      {
          struct client *cl = l->client;
-         const char *strategy_plus_sort = get_strategy_plus_sort(cl, field);
-         if (strategy_plus_sort)
-         {
-             struct timeval tval;
-             if (client_prep_connection(cl, se->service->z3950_operation_timeout,
-                                        se->service->z3950_session_timeout,
-                                        se->service->server->iochan_man,
-                                        &tval))
-                 client_start_search(cl, strategy_plus_sort, increasing);
-         }
+         struct timeval tval;
+         if (client_prep_connection(cl, se->service->z3950_operation_timeout,
+                                    se->service->z3950_session_timeout,
+                                    se->service->server->iochan_man,
+                                    &tval))
+             client_start_search(cl);
      }
      session_leave(se);
  }
@@@ -747,55 -687,33 +712,54 @@@ enum pazpar2_error_code session_search(
          session_leave(se);
          return PAZPAR2_MALFORMED_PARAMETER_VALUE;
      }
 -    for (l = se->clients; l; l = l->next)
 +
 +    l0 = se->clients_active;
 +    se->clients_active = 0;
 +    session_leave(se);
 +
 +    for (l = l0; l; l = l->next)
      {
 +        int parse_ret;
          struct client *cl = l->client;
-         const char *strategy_plus_sort = get_strategy_plus_sort(cl, sort_field);
  
 -        if (maxrecs)
 -            client_set_maxrecs(cl, atoi(maxrecs));
 -        if (startrecs)
 -            client_set_startrecs(cl, atoi(startrecs));
 -        if (prepare_session_database(se, client_get_database(cl)) < 0)
 -            ;
 -        else if (client_parse_query(cl, query, facet_limits) < 0)
 -            no_failed++;
 -        else
 +        if (prepare_map(se, client_get_database(cl)) < 0)
 +            continue;
 +
 +        parse_ret = client_parse_query(cl, query, facet_limits, startrecs,
 +            maxrecs);
 +        if (parse_ret == -1)
 +            no_failed_query++;
 +        else if (parse_ret == -2)
 +            no_failed_limit++;
 +        else if (parse_ret == 0)
          {
 +            session_log(se, YLOG_LOG, "client NEW %s", client_get_id(cl));
              no_working++;
              if (client_prep_connection(cl, se->service->z3950_operation_timeout,
                                         se->service->z3950_session_timeout,
                                         se->service->server->iochan_man,
                                         &tval))
-                 client_start_search(cl, strategy_plus_sort, increasing);
+                 client_start_search(cl);
          }
 +        else
 +        {
 +            session_log(se, YLOG_LOG, "client REUSE %s", client_get_id(cl));
 +            no_working++;
 +            if (client_prep_connection(cl, se->service->z3950_operation_timeout,
 +                                       se->service->z3950_session_timeout,
 +                                       se->service->server->iochan_man,
 +                                       &tval))
 +            {
 +                client_reingest(cl);
 +            }
 +        }
      }
      facet_limits_destroy(facet_limits);
 -    session_leave(se);
 +    session_reset_active_clients(se, l0);
 +
      if (no_working == 0)
      {
 -        if (no_failed > 0)
 +        if (no_failed_query > 0)
          {
              *addinfo = "query";
              return PAZPAR2_MALFORMED_PARAMETER_VALUE;
diff --cc src/session.h
Simple merge