return sessions;
}
-int sessions_count(void)
+int sessions_get_count(void)
{
return session_use(0);
}
l->next = se->clients_cached;
se->clients_cached = l;
}
- /* set session always. If may be 0 if client is not active */
client_set_session(cl, se);
l = xmalloc(sizeof(*l));
client_lock(l->client);
client_set_session(l->client, 0);
client_set_database(l->client, 0);
+ client_mark_dead(l->client);
client_unlock(l->client);
client_destroy(l->client);
xfree(l);
int no_sortmap = 0;
struct client_list *l;
- session_log(se, YLOG_DEBUG, "Search");
+ session_log(se, YLOG_LOG, "search query %s", query);
+ if (filter)
+ session_log(se, YLOG_LOG, "search filter %s", filter);
+ if (limit)
+ session_log(se, YLOG_LOG, "search limit %s", limit);
*addinfo = 0;
no_working++;
}
}
- yaz_log(YLOG_LOG, "session_search: no_working=%d no_sortmap=%d",
- no_working, no_sortmap);
+ session_log(se, YLOG_LOG, "search "
+ "working %d sortmap %d failed-query %d failed-limit %d",
+ no_working, no_sortmap, no_failed_query, no_failed_limit);
session_enter(se, "session_search2");
if (no_working == 1 && no_sortmap == 1)
{
void session_destroy(struct session *se)
{
struct session_database *sdb;
- session_log(se, YLOG_LOG, "destroy");
- session_use(-1);
+ struct facet_id *t;
+ int sessions_total = session_use(-1);
+ int no_facet_ids = 0;
+
+ for (t = se->facet_id_list; t; t = t->next)
+ no_facet_ids++;
+ session_log(se, YLOG_LOG, "destroy "
+ "session-total %d nmem-op %zd nmem-ses %zd facets-ids %d",
+ sessions_total,
+ nmem_total(se->nmem), nmem_total(se->session_nmem),
+ no_facet_ids);
session_remove_cached_clients(se);
for (sdb = se->databases; sdb; sdb = sdb->next)
reclist_destroy(se->reclist);
xfree(se->mergekey);
xfree(se->rank);
- if (nmem_total(se->nmem))
- session_log(se, YLOG_DEBUG, "NMEN operation usage %zd", nmem_total(se->nmem));
- if (nmem_total(se->session_nmem))
- session_log(se, YLOG_DEBUG, "NMEN session usage %zd", nmem_total(se->session_nmem));
facet_limits_destroy(se->facet_limits);
nmem_destroy(se->nmem);
service_destroy(se->service);
}
-struct session *new_session(NMEM nmem, struct conf_service *service,
- unsigned session_id)
+struct session *session_create(NMEM nmem, struct conf_service *service,
+ unsigned session_id)
{
int i;
struct session *session = nmem_malloc(nmem, sizeof(*session));
session->normalize_cache = normalize_cache_create();
session->session_mutex = 0;
pazpar2_mutex_create(&session->session_mutex, tmp_str);
- session_log(session, YLOG_LOG, "create");
- session_use(1);
+ i = session_use(1);
+ session_log(session, YLOG_LOG, "create session-total %d", i);
return session;
}
if (!value0 || !*value0)
{
const char *empty = yaz_xml_get_prop(n, "empty");
+ if (value0)
+ xmlFree(value0);
if (!empty)
continue;
wrbuf_puts(wrbuf_disp, (const char *) empty);
else
{
wrbuf_puts(wrbuf_disp, (const char *) value0);
- }
- if (value0)
xmlFree(value0);
+ }
ser_md = &service->metadata[md_field_id];
// non-merged metadata