X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsession.c;h=49425d57c3838ef23986fbde56d4cc9854282d80;hb=64dccf5757a22cedd3c21ca834e3e02f39dd0504;hp=41447c64145b24c5d9901d0b99a9c0455b4c5cfc;hpb=4b259026074c2fb5931eac168a64e8df0be46e30;p=pazpar2-moved-to-github.git diff --git a/src/session.c b/src/session.c index 41447c6..49425d5 100644 --- a/src/session.c +++ b/src/session.c @@ -113,7 +113,7 @@ static int session_use(int delta) return sessions; } -int sessions_count(void) +int sessions_get_count(void) { return session_use(0); } @@ -1048,8 +1048,17 @@ void session_apply_setting(struct session *se, const char *dbname, 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) @@ -1059,10 +1068,6 @@ void session_destroy(struct session *se) 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); @@ -1080,8 +1085,8 @@ size_t session_get_memory_status(struct session *session) { } -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)); @@ -1121,9 +1126,9 @@ struct session *new_session(NMEM nmem, struct conf_service *service, 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; }