Source
void *data, int timeout, zbx_async_task_process_cb_t process_cb, zbx_async_task_clear_cb_t clear_cb)
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
typedef struct
{
void *data;
zbx_async_task_process_cb_t process_cb;
zbx_async_task_clear_cb_t free_cb;
struct event *tx_event;
struct event *rx_event;
struct event *timeout_event;
char ip[65];
int timeout;
char *error;
}
zbx_async_task_t;
static void async_task_remove(zbx_async_task_t *task)
{
task->free_cb(task->data);
if (NULL != task->rx_event)
event_free(task->rx_event);
if (NULL != task->tx_event)
event_free(task->tx_event);
event_free(task->timeout_event);
zbx_free(task->error);
zbx_free(task);
}
static const char *task_state_to_str(zbx_async_task_state_t task_state)
{
switch (task_state)
{
case ZBX_ASYNC_TASK_WRITE:
return "ZBX_ASYNC_TASK_WRITE";