int clients_count(void)
{
- int total = 0;
- if (g_mutex)
- {
- yaz_mutex_enter(g_mutex);
- total = no_clients;
- yaz_mutex_leave(g_mutex);
- }
- return total;
+ return client_use(0);
}
/** \brief Represents client state for a connection to one search target */
Client_Disconnected
};
+int clients_count(void);
int client_show_raw_begin(struct client *cl, int position,
const char *syntax, const char *esn,
void *data,
release_session(c, s);
}
-int sessions_count(void);
-int clients_count(void);
#ifdef HAVE_RESULTSETS_COUNT
int resultsets_count(void);
#else
/* session counting (1) , disable client counting (0) */
static YAZ_MUTEX g_session_mutex = 0;
static int no_sessions = 0;
-static int no_session_total = 0;
static int session_use(int delta)
{
yaz_mutex_create(&g_session_mutex);
yaz_mutex_enter(g_session_mutex);
no_sessions += delta;
- if (delta > 0)
- no_session_total += delta;
sessions = no_sessions;
yaz_mutex_leave(g_session_mutex);
yaz_log(YLOG_DEBUG, "%s sessions=%d", delta == 0 ? "" : (delta > 0 ? "INC" : "DEC"), no_sessions);
return session_use(0);
}
-int session_count_total(void)
-{
- int total = 0;
- if (!g_session_mutex)
- return 0;
- yaz_mutex_enter(g_session_mutex);
- total = no_session_total;
- yaz_mutex_leave(g_session_mutex);
- return total;
-}
-
static void log_xml_doc(xmlDoc *doc)
{
FILE *lf = yaz_log_file();
struct hitsbytarget *get_hitsbytarget(struct session *s, int *count, NMEM nmem);
struct session *new_session(NMEM nmem, struct conf_service *service,
unsigned session_id);
+int sessions_count(void);
void session_destroy(struct session *s);
void session_init_databases(struct session *s);
void statistics(struct session *s, struct statistics *stat);