X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fclient.c;h=4c6c78084f7309c1df3cab5ae93e26d24539a1e3;hb=2ee54f76ebb2510e313a0ad34d09a23d0d9c23ae;hp=be1bae91adf60f3593c5ee8f6e2da817091ce73b;hpb=ba5951a80fdd0da1d28c318852b69a1178cd6bfa;p=pazpar2-moved-to-github.git diff --git a/src/client.c b/src/client.c index be1bae9..4c6c780 100644 --- a/src/client.c +++ b/src/client.c @@ -58,7 +58,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #endif -#include "pazpar2.h" +#include "session.h" #include "parameters.h" #include "client.h" #include "connection.h" @@ -104,8 +104,6 @@ static const char *client_states[] = { "Client_Disconnected" }; -static struct client *client_freelist = 0; /* thread pr */ - const char *client_get_state_str(struct client *cl) { return client_states[cl->state]; @@ -457,13 +455,14 @@ void client_record_response(struct client *cl) else { struct session_database *sdb = client_get_database(cl); + NMEM nmem = nmem_create(); const char *xmlrec; char type[80]; if (nativesyntax_to_type(sdb, type, rec)) yaz_log(YLOG_WARN, "Failed to determine record type"); if ((xmlrec = ZOOM_record_get(rec, type, NULL))) { - if (ingest_record(cl, xmlrec, cl->record_offset)) + if (!ingest_record(cl, xmlrec, cl->record_offset, nmem)) { session_alert_watch(cl->session, SESSION_WATCH_SHOW); session_alert_watch(cl->session, SESSION_WATCH_RECORD); @@ -473,6 +472,7 @@ void client_record_response(struct client *cl) } else yaz_log(YLOG_WARN, "Failed to extract ZOOM record"); + nmem_destroy(nmem); } } @@ -562,14 +562,7 @@ void client_start_search(struct client *cl) struct client *client_create(void) { - struct client *r; - if (client_freelist) - { - r = client_freelist; - client_freelist = client_freelist->next; - } - else - r = xmalloc(sizeof(struct client)); + struct client *r = xmalloc(sizeof(*r)); r->maxrecs = 100; r->startrecs = 0; r->pquery = 0; @@ -607,9 +600,7 @@ void client_destroy(struct client *c) connection_release(c->connection); ZOOM_resultset_destroy(c->resultset); - c->resultset = 0; - c->next = client_freelist; - client_freelist = c; + xfree(c); } void client_set_connection(struct client *cl, struct connection *con)