Source
static void pg_get_proxy_group_stats(zbx_pg_service_t *pgs, zbx_ipc_client_t *client, zbx_ipc_message_t *message)
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: move hosts between proxy groups in cache *
* *
* Parameter: pgs - [IN] proxy group service *
* message - [IN] IPC message with host relocation data *
* *
******************************************************************************/
static void pg_update_host_pgroup(zbx_pg_service_t *pgs, zbx_ipc_message_t *message)
{
unsigned char *ptr = message->data;
zbx_uint64_t hostid, srcid, dstid;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
pg_cache_lock(pgs->cache);
(void)pg_cache_update_groups(pgs->cache);
while (ptr - message->data < message->size)
{
zbx_pg_group_t *group;
ptr += zbx_deserialize_value(ptr, &hostid);
ptr += zbx_deserialize_value(ptr, &srcid);
ptr += zbx_deserialize_value(ptr, &dstid);
if (srcid == dstid)
{
/* handle host name change by re-assigning host to the same proxy */
/* causing its hostmap revision to change */
zbx_pg_host_t *host;
zbx_pg_proxy_t *proxy;
if (NULL == (host = (zbx_pg_host_t *)zbx_hashset_search(&pgs->cache->hostmap, &hostid)))
continue;