Add MARC field 876$f to tmarc.xsl, named "loan-period", #4411
[pazpar2-moved-to-github.git] / src / session.c
index 405d53b..545f0fc 100644 (file)
@@ -86,7 +86,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 struct parameters global_parameters = 
 {
     0,   // dump_records
-    0    // debug_mode
+    0,   // debug_mode
+    0,   // predictable sessions
 };
 
 struct client_list {
@@ -589,8 +590,6 @@ int session_is_preferred_clients_ready(struct session *s)
     return res == 0;
 }
 
-
-
 enum pazpar2_error_code search(struct session *se,
                                const char *query,
                                const char *startrecs, const char *maxrecs,
@@ -759,12 +758,6 @@ void session_apply_setting(struct session *se, char *dbname, char *setting,
     }
 }
 
-/* Depreciated: use session_destroy */
-void destroy_session(struct session *se)
-{
-    session_destroy(se);
-}
-
 void session_destroy(struct session *se) {
     struct session_database *sdb;
     session_log(se, YLOG_DEBUG, "Destroying");
@@ -780,9 +773,13 @@ void session_destroy(struct session *se) {
     service_destroy(se->service);
     yaz_mutex_destroy(&se->session_mutex);
     wrbuf_destroy(se->wrbuf);
-
 }
 
+/* Depreciated: use session_destroy */
+void destroy_session(struct session *se)
+{
+    session_destroy(se);
+}
 
 size_t session_get_memory_status(struct session *session) {
     size_t session_nmem;
@@ -859,14 +856,16 @@ struct hitsbytarget *hitsbytarget(struct session *se, int *count, NMEM nmem)
         res[*count].state = client_get_state_str(cl);
         res[*count].connected  = client_get_connection(cl) ? 1 : 0;
         session_settings_dump(se, client_get_database(cl), w);
-        res[*count].settings_xml = w;
+        res[*count].settings_xml = nmem_strdup(nmem, wrbuf_cstr(w));
+        wrbuf_destroy(w);
         (*count)++;
     }
     session_leave(se);
     return res;
 }
 
-struct termlist_score **termlist(struct session *se, const char *name, int *num)
+struct termlist_score **get_termlist_score(struct session *se,
+                                           const char *name, int *num)
 {
     int i;
     struct termlist_score **tl = 0;
@@ -1503,7 +1502,6 @@ static int ingest_to_cluster(struct client *cl,
             // construct facets ... unless the client already has reported them
             if (ser_md->termlist && !client_has_facet(cl, (char *) type))
             {
-
                 if (ser_md->type == Metadata_type_year)
                 {
                     char year[64];