X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Flogic.c;h=976867186955876f2402c9c3b8885b74c24b7db7;hb=0af8f955aa45654c26de64601d92dbc5258d5809;hp=350d8802be71d88dfaf871de85552365e0d074c0;hpb=90dcde08cb73241173e22e84362c6acf9ee92276;p=pazpar2-moved-to-github.git diff --git a/src/logic.c b/src/logic.c index 350d880..9768671 100644 --- a/src/logic.c +++ b/src/logic.c @@ -21,13 +21,25 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \brief high-level logic; mostly user sessions and settings */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include +#if HAVE_SYS_TIME_H #include +#endif +#if HAVE_UNISTD_H #include +#endif +#if HAVE_SYS_SOCKET_H #include +#endif +#if HAVE_NETDB_H #include +#endif #include #include #include @@ -46,16 +58,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include -#if HAVE_CONFIG_H -#include "cconfig.h" -#endif - #define USE_TIMING 0 #if USE_TIMING #include #endif +#if HAVE_NETINET_IN_H #include +#endif #include "pazpar2.h" #include "eventl.h" @@ -63,7 +73,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "termlists.h" #include "reclists.h" #include "relevance.h" -#include "config.h" #include "database.h" #include "client.h" #include "settings.h" @@ -838,6 +847,7 @@ struct session *new_session(NMEM nmem) session->relevance = 0; session->total_hits = 0; session->total_records = 0; + session->number_of_warnings_unknown_elements = 0; session->num_termlists = 0; session->reclist = 0; session->requestid = -1; @@ -1007,7 +1017,7 @@ void statistics(struct session *se, struct statistics *stat) stat->num_clients = count; } -void start_http_listener(void) +int start_http_listener(void) { char hp[128] = ""; struct conf_server *ser = global_parameters.server; @@ -1024,7 +1034,7 @@ void start_http_listener(void) sprintf(hp + strlen(hp), "%d", ser->port); } } - http_init(hp); + return http_init(hp); } void start_proxy(void) @@ -1216,8 +1226,10 @@ struct record *ingest_record(struct client *cl, Z_External *rec, value, type); continue; } - rec_md->next = record->metadata[md_field_id]; - record->metadata[md_field_id] = rec_md; + wheretoput = &record->metadata[md_field_id]; + while (*wheretoput) + wheretoput = &(*wheretoput)->next; + *wheretoput = rec_md; // merged metadata rec_md = record_metadata_init(se->nmem, (char *) value, @@ -1339,9 +1351,13 @@ struct record *ingest_record(struct client *cl, Z_External *rec, xmlFree(value); type = value = 0; } - else - yaz_log(YLOG_WARN, - "Unexpected element %s in internal record", n->name); + else + { + if (se->number_of_warnings_unknown_elements == 0) + yaz_log(YLOG_WARN, + "Unexpected element in internal record: %s", n->name); + se->number_of_warnings_unknown_elements++; + } } if (type) xmlFree(type);