zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_dc_get_proxy_lastaccess                                      *
 *                                                                            *
 * Purpose: returns proxy lastaccess changes since last lastaccess request    *
 *                                                                            *
 * Parameter: lastaccess - [OUT] last access updates for proxies that need    *
 *                               to be synced with database, sorted by        *
 *                               hostid                                       *
 *                                                                            *
 ******************************************************************************/
zbx_dc_get_proxy_lastaccess

Purpose: returns proxy lastaccess changes since last lastaccess request

Parameter: lastaccess - [OUT] last access updates for proxies that need
to be synced with database, sorted by
hostid
zbx_dc_get_proxy_lastaccess Purpose : returns proxy lastaccess changes since last lastaccess request Parameter : lastaccess - [ OUT ] last access updates for proxies that need to be synced with database sorted by hostid
void	zbx_dc_get_proxy_lastaccess(zbx_vector_uint64_pair_t *lastaccess)
{
	ZBX_DC_PROXY	*proxy;
	int		now;
	if (ZBX_PROXY_LASTACCESS_UPDATE_FREQUENCY < (now = time(NULL)) - config->proxy_lastaccess_ts)
	{
		zbx_hashset_iter_t	iter;
		WRLOCK_CACHE;
		zbx_hashset_iter_reset(&config->proxies, &iter);
		while (NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_iter_next(&iter)))
		{
			if (proxy->lastaccess >= config->proxy_lastaccess_ts)
			{
				zbx_uint64_pair_t	pair = {proxy->hostid, proxy->lastaccess};
				zbx_vector_uint64_pair_append(lastaccess, pair);
			}
		}
		config->proxy_lastaccess_ts = now;
		UNLOCK_CACHE;
		zbx_vector_uint64_pair_sort(lastaccess, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
	}
}
void zbx_dc_get_proxy_lastaccess ( zbx_vector_uint64_pair_t * lastaccess ) { ZBX_DC_PROXY * proxy ; int now ; if ( ZBX_PROXY_LASTACCESS_UPDATE_FREQUENCY < ( now = time ( NULL ) ) - config -> proxy_lastaccess_ts ) { zbx_hashset_iter_t iter ; WRLOCK_CACHE ; zbx_hashset_iter_reset ( & config -> proxies , & iter ) ; while ( NULL != ( proxy = ( ZBX_DC_PROXY * ) zbx_hashset_iter_next ( & iter ) ) ) { if ( proxy -> lastaccess >= config -> proxy_lastaccess_ts ) { zbx_uint64_pair_t pair = { proxy -> hostid , proxy -> lastaccess } ; zbx_vector_uint64_pair_append ( lastaccess , pair ) ; } } config -> proxy_lastaccess_ts = now ; UNLOCK_CACHE ; zbx_vector_uint64_pair_sort ( lastaccess , ZBX_DEFAULT_UINT64_COMPARE_FUNC ) ; } }
Function: zbx_dc_get_proxy_lastaccess                                      
                                                                            
 Purpose: returns proxy lastaccess changes since last lastaccess request    
                                                                            
 Parameter: lastaccess - [OUT] last access updates for proxies that need    
                               to be synced with database, sorted by        
                               hostid
Function : zbx_dc_get_proxy_lastaccess Purpose : returns proxy lastaccess changes since last lastaccess request Parameter : lastaccess - [ OUT ] last access updates for proxies that need to be synced with database sorted by hostid