zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_dc_cleanup_data_sessions                                     *
 *                                                                            *
 * Purpose: removes data sessions not accessed for 24 hours                   *
 *                                                                            *
 ******************************************************************************/
zbx_dc_cleanup_data_sessions

Purpose: removes data sessions not accessed for 24 hours
zbx_dc_cleanup_data_sessions Purpose : removes data sessions not accessed for 24 hours
void	zbx_dc_cleanup_data_sessions(void)
{
	zbx_data_session_t	*session;
	zbx_hashset_iter_t	iter;
	time_t			now;
	now = time(NULL);
	WRLOCK_CACHE;
	zbx_hashset_iter_reset(&config->data_sessions, &iter);
	while (NULL != (session = (zbx_data_session_t *)zbx_hashset_iter_next(&iter)))
	{
		if (session->lastaccess + SEC_PER_DAY <= now)
		{
			__config_mem_free_func((char *)session->token);
			zbx_hashset_iter_remove(&iter);
		}
	}
	UNLOCK_CACHE;
}
void zbx_dc_cleanup_data_sessions ( void ) { zbx_data_session_t * session ; zbx_hashset_iter_t iter ; time_t now ; now = time ( NULL ) ; WRLOCK_CACHE ; zbx_hashset_iter_reset ( & config -> data_sessions , & iter ) ; while ( NULL != ( session = ( zbx_data_session_t * ) zbx_hashset_iter_next ( & iter ) ) ) { if ( session -> lastaccess + SEC_PER_DAY <= now ) { __config_mem_free_func ( ( char * ) session -> token ) ; zbx_hashset_iter_remove ( & iter ) ; } } UNLOCK_CACHE ; }
Function: zbx_dc_cleanup_data_sessions                                     
                                                                            
 Purpose: removes data sessions not accessed for 24 hours
Function : zbx_dc_cleanup_data_sessions Purpose : removes data sessions not accessed for 24 hours