X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Flogic.c;h=92a0ecf8fc386c4efb004357add2a4834d60424f;hb=67ebd94d4bd94b8ade005dfa371638e0855f84d1;hp=07f225410a75659f223726d012de8b5d8c4be7d8;hpb=5a145dc87e4756afc3e247cded32a9666457f065;p=pazpar2-moved-to-github.git diff --git a/src/logic.c b/src/logic.c index 07f2254..92a0ecf 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" @@ -1006,7 +1016,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; @@ -1023,7 +1033,7 @@ void start_http_listener(void) sprintf(hp + strlen(hp), "%d", ser->port); } } - http_init(hp); + return http_init(hp); } void start_proxy(void) @@ -1215,8 +1225,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, @@ -1225,6 +1237,12 @@ struct record *ingest_record(struct client *cl, Z_External *rec, // and polulate with data: // assign cluster or record based on merge action + if (ser_md->merge == Metadata_merge_no) + { + while (*wheretoput) + wheretoput = &(*wheretoput)->next; + *wheretoput = rec_md; + } if (ser_md->merge == Metadata_merge_unique) { struct record_metadata *mnode;