#if HAVE_CONFIG_H
#include <config.h>
#endif
-
+#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <yaz/timing.h>
#endif
+#include "ppmutex.h"
#include "session.h"
#include "parameters.h"
#include "client.h"
{
strcpy(type, "xml");
}
+ else if (!strncmp(s, "txml", 4))
+ {
+ const char *cp = strchr(s, ';');
+ yaz_snprintf(type, 80, "txml; charset=%s", cp ? cp+1 : "marc-8s");
+ }
else
return -1;
return 0;
strcpy(type, "xml");
return 0;
}
+ else if (!strcmp(syntax, "TXML"))
+ {
+ strcpy(type, "txml");
+ return 0;
+ }
else if (!strcmp(syntax, "USmarc") || !strcmp(syntax, "MARC21"))
{
strcpy(type, "xml; charset=marc8-s");
if (cl->session == 0)
;
else if (ZOOM_record_error(rec, &msg, &addinfo, 0))
+ {
yaz_log(YLOG_WARN, "Record error %s (%s): %s (rec #%d)",
- error, addinfo, client_get_url(cl),
+ msg, addinfo, client_get_url(cl),
cl->record_offset);
+ }
else
{
struct session_database *sdb = client_get_database(cl);
NMEM nmem = nmem_create();
const char *xmlrec;
char type[80];
- yaz_log(YLOG_LOG, "Record ingest begin client=%p session=%p", cl, cl->session);
+
if (nativesyntax_to_type(sdb, type, rec))
yaz_log(YLOG_WARN, "Failed to determine record type");
xmlrec = ZOOM_record_get(rec, type, NULL);
client_get_url(cl));
}
nmem_destroy(nmem);
- yaz_log(YLOG_LOG, "Record ingest end client=%p session=%p", cl, cl->session);
}
}
else
r->resultset = 0;
r->next = 0;
r->mutex = 0;
- yaz_mutex_create(&r->mutex);
- yaz_mutex_set_name(r->mutex, "client");
+ pazpar2_mutex_create(&r->mutex, "client");
r->ref_count = 1;
void client_incref(struct client *c)
{
pazpar2_incref(&c->ref_count, c->mutex);
- yaz_log(YLOG_DEBUG, "client_incref %s %d", client_get_url(c), c->ref_count);
+ yaz_log(YLOG_LOG, "client_incref c=%p %s cnt=%d",
+ c, client_get_url(c), c->ref_count);
}
int client_destroy(struct client *c)
{
if (c)
{
- yaz_log(YLOG_DEBUG, "client_destroy %s %d",
- client_get_url(c), c->ref_count);
+ yaz_log(YLOG_LOG, "client_destroy c=%p %s cnt=%d",
+ c, client_get_url(c), c->ref_count);
if (!pazpar2_decref(&c->ref_count, c->mutex))
{
c->next = 0;
void client_remove_from_session(struct client *c)
{
struct session *se;
- client_incref(c);
se = c->session;
assert(se);
c->session = 0;
c->next = 0;
}
- client_destroy(c);
}
void client_set_session(struct client *cl, struct session *se)